Commit 250feebc authored by Steven Fuller's avatar Steven Fuller

NOTES, README, TODO: Doc updates

id_heads.h, wl_game.c, wl_play.c: changed mapwidth/mapheight to #defines,
since only maps with size 64x64 are allowed

vi_xlib.c, vi_svga.c, vi_null.c, vi_wdx.c, id_vh.c: moved VL_DeModeXize
to id_vh.c

vi_xlib.c: Part 2 of rewrite
parent 1ae2b9f3
......@@ -12,9 +12,9 @@ Just some random facts/thoughts/ideas/musings:
* Rumored/Never Released?
- Atari Lynx
- Sega Genesis (was cancelled after a month)
- Japanese PC Version
- Spanish PC Version
- Japanese Mac Version
- Japanese PC Version (referenced in source)
- Spanish PC Version (referenced in source)
- Japanese Mac Version (referenced in source ??)
* Unofficial ports:
- Linux (this, xwolf, wolfgl)
......@@ -24,20 +24,36 @@ Just some random facts/thoughts/ideas/musings:
- Windows (wolfgl) [http://www.sourceforge.net/projects/wolfgl/]
- Acorn/Archemedes
* PC source released on:
- now many ports, projects, etc
- urls
- http://www.abraxis.com/brucel/wolf3d.html
- http://www.wolf3dbunker.com
* Macintosh source released January 22(?), 2000
- url
* TED source (editor used for tons of games including wolf3d)
* PC source released August(?) ??, 1995:
- ftp://ftp.idsoftware.com/idstuff/source/wolfsrc.zip
* now many ports, projects, etc
- http://www.abraxis.com/brucel/wolf3d.html
- http://www.wolf3dbunker.com
- http://www.wolf3dmansion.com/index.phtml
* Macintosh source released January 21, 2000
- http://www.maccentral.com/news/0001/24.wolf3d.shtml
* TED5 source (editor used for tons of games including wolf3d)
- ftp://ftp.3drealms.com/misc/ted5.zip
* Games which used the Wolfenstein 3D Engine:
- Blake Stone
- Corridor 7
- Operation Body Count
Apogee FAQ (lots of information regarding Wolf3D):
- http://www.rinkworks.com/apogee/
Wolfenstein 3D FAQ:
- http://www.wolf3d.co.uk/Wolfenstein-3D.faq
How to get Wolfenstein 3D:
- Wolfenstein 3D Shareware:
ftp://ftp.gamers.org/pub/games/wolf3d/official/1wolf14.zip
http://www.3drealms.com/downloads.html
- Spear of Destiny Demo:
ftp://ftp.gamers.org/pub/3daction/00archives/speardestiny/releases/soddemo2.zip
- Macintosh versions: TODO
- Where to Buy: TODO
Wolfenstein 3D was originally planned to be a much more complex game. ...
... lots of unused code ... possibly from previous projects and incarnations
of wolf3d.
......@@ -46,3 +62,6 @@ Version 1.4 of Wolfenstein 3D (full) did not had a Read Me! option, but the
text still exists in the data files, but all the graphics are incorrect
(wrong graphic numbers, etc).
-----
Steven Fuller
relnev@atdot.org
Someone is actually reading the README...
<put links here>
http://rinkworks.com/apogee/s/2.4.5.shtml
http://www.3dportal.com/hideout/stuff/odd.html
http://www.maccentral.com/news/0001/24.wolf3d.shtml
Hi.
-----
Steven Fuller
......
------------------------------------------------------------------------------
Control Menu:
* TODO
......@@ -13,32 +14,70 @@ Sound Menu:
* Sampling Rate:
- 44100
- 22050
------------------------------------------------------------------------------
[Indexed?]:
Yes:
- palette (8bit)
No:
- truecolor (15, 16, 24, 32)
[Shm?]:
Yes:
- XShmImage
No:
- XImage
[Windowed]:
- [Indexed?]
- [Shm?]
[DGA1?]:
Yes:
- YES
No:
- NO
[DGA2?]:
Yes:
- YES
No:
- [DGA1?]
[DGA?]:
- [DGA2?]
Yes:
- [Indexed?]
No:
- [Windowed]
[Fullscreen?]:
Yes:
- [DGA?]
No:
- [Windowed]
[Init]:
- [Fullscreen?]
------------------------------------------------------------------------------
*
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
SD_StartMusic(chunk);
------------------------------------------------------------------------------
* would be nice if Quit() used vsnprintf, etc
* actor walking through door is drawn in front of door: near end of E1M1 for
example
* move DeModeXize so it does not have to be in every vi_ file
* clean up vi_xlib.c: fix vid mode changing, fix dga for non8bit modes and
the nonpalette setting stuff... lots of if statements
also, it should be able to compile without extensions
also, update xlib code with new knowledge of how things work
* getenv so that you can point an env. var to the proper dir
* refresh rate under svgalib is horrible. the screen keeps getting updated
midframe. it's due to the way CalcTics works
* rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode
* proper left/right sound
* adlib sounds seem like they play at twice the freq
* set up a "build number" system where every time a file is recompiled via
make (ver.c depends on the source code) the number is incremented and so on
note: this debug system would have to be disabled for all public releases to
prevent confusion. OR ver.c would depend on the source, but it does not have
a version number, just __TIME__. this version id would be used for
savegames until they are fixed to not use pointers
* fix config file and savegames
* use static and const where appropriate
* convert uses of open() to fopen(), etc maybe
* menu code is a mess, always does things differently than the rest of the
......@@ -63,7 +102,6 @@ key type, and for everything not scancode-based, have a function to
translate
* wl_menu uses specific scancodes for names, config file will have to use
metaname like sc_Left etc or something
* perhaps rename UPLOAD
* add a ViewMap? (could be done similar to mac version)
* find and remove any function stubs (functions which just call another
function with same parameters, only difference is the name)
......@@ -80,13 +118,8 @@ PlayDemoFromFile specifically
* deathcam went by too fast, and right before the fizzlefade was being done
on the border
same with the spear of destiny animation part of ending
* move all references to gfxbuf to vi_* only (gl will need this anyway,
since it would replace id_vh, (parts of) wl_draw)
by putting in code from id_vh (either by using Plot or just copying it in)
we can mostly stop the large conversion before each UpdateScreen
* the higher depths are a hack since a palette lookup has to be done
for every byte when transferring to the pixmap, palette fades require a
screen update
* reduce code duplication in the vi_* files.
* split wl_draw into two files (draw independent, draw dependent)
* make sure none of the non-loader code tries to handle gfx/sound data
directly
* when window loses focus, it should clear the keys
......@@ -99,3 +132,4 @@ pcm sound len / 100).
Things to try:
* Create a native palette format instead of doing conversions each frame
------------------------------------------------------------------------------
......@@ -91,7 +91,9 @@ typedef enum { false, true } boolean;
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long longword;
typedef unsigned int longword;
typedef unsigned long dword;
typedef long fixed;
typedef void * memptr;
......@@ -123,7 +125,10 @@ void Quit(char *error);
#define MAXTICS 10
#define DEMOTICS 4
extern unsigned mapwidth, mapheight, tics;
extern unsigned tics;
#define mapwidth 64
#define mapheight 64
extern byte fontcolor, backcolor;
......
......@@ -10,7 +10,7 @@ int fontnumber;
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
static byte palette1[256][3], palette2[256][3];
/* ======================================================================== */
......@@ -259,3 +259,29 @@ void VL_CacheScreen(int chunk)
VL_MemToScreen(grsegs[chunk], 320, 200, 0, 0);
CA_UnCacheGrChunk(chunk);
}
void VL_DeModeXize(byte *buf, int width, int height)
{
byte *mem, *ptr, *destline;
int plane, x, y;
if (width & 3) {
printf("Not divisible by 4?\n");
return;
}
mem = malloc(width * height);
ptr = buf;
for (plane = 0; plane < 4; plane++) {
destline = mem;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++)
*(destline + x*4 + plane) = *ptr++;
destline += width;
}
}
memcpy(buf, mem, width * height);
free(mem);
}
......@@ -173,27 +173,20 @@ extern ScanCode LastScan;
extern KeyboardDef KbdDefs;
extern ControlType Controls[MaxPlayers];
// Function prototypes
#define IN_KeyDown(code) (Keyboard[(code)])
#define IN_ClearKey(code) { \
Keyboard[code] = false; \
if (code == LastScan) \
LastScan = sc_None; \
}
extern void IN_Startup(void),IN_Shutdown(void),
IN_ClearKeysDown(void),
extern void IN_Startup(), IN_Shutdown(), IN_ClearKeysDown(),
IN_ReadControl(int,ControlInfo *),
IN_GetJoyAbs(word joy,word *xp,word *yp),
IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy),
IN_Ack(void);
IN_Ack();
extern boolean IN_UserInput(longword delay);
extern char *IN_GetScanName(ScanCode);
extern boolean IN_UserInput(longword delay);
extern char *IN_GetScanName(ScanCode);
byte IN_MouseButtons();
byte IN_JoyButtons();
byte IN_MouseButtons();
byte IN_JoyButtons();
void INL_GetJoyDelta(word joy,int *dx,int *dy);
void IN_StartAck();
......
......@@ -243,30 +243,6 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y)
}
}
void VL_DeModeXize(byte *buf, int width, int height)
{
byte *mem, *ptr, *destline;
int plane, x, y;
if (width & 3) {
printf("Not divisible by 4?\n");
return;
}
mem = malloc(width * height);
ptr = buf;
for (plane = 0; plane < 4; plane++) {
destline = mem;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++)
*(destline + x*4 + plane) = *ptr++;
destline += width;
}
}
memcpy(buf, mem, width * height);
free(mem);
}
void VL_DirectPlot(int x1, int y1, int x2, int y2)
{
}
......
......@@ -277,30 +277,6 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y)
}
}
void VL_DeModeXize(byte *buf, int width, int height)
{
byte *mem, *ptr, *destline;
int plane, x, y;
if (width & 3) {
printf("Not divisible by 4?\n");
return;
}
mem = malloc(width * height);
ptr = buf;
for (plane = 0; plane < 4; plane++) {
destline = mem;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++)
*(destline + x*4 + plane) = *ptr++;
destline += width;
}
}
memcpy(buf, mem, width * height);
free(mem);
}
void VL_DirectPlot(int x1, int y1, int x2, int y2)
{
*(graph_mem + x1 + y1 * 320) = *(gfxbuf + x2 + y2 * 320);
......
......@@ -528,32 +528,6 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y)
}
}
/* TODO: can this go in id_vh.c? */
void VL_DeModeXize(byte *buf, int width, int height)
{
byte *mem, *ptr, *destline;
int plane, x, y;
if (width & 3) {
printf("Not divisible by 4?\n");
return;
}
/* TODO: is there a better way without mallocing extra memory? */
mem = malloc(width * height);
ptr = buf;
for (plane = 0; plane < 4; plane++) {
destline = mem;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++)
*(destline + x*4 + plane) = *ptr++;
destline += width;
}
}
memcpy(buf, mem, width * height);
free(mem);
}
void VL_DirectPlot(int x1, int y1, int x2, int y2)
{
......
......@@ -38,62 +38,12 @@ int fullscreen;
int dga;
byte *dgabuf;
int dgawidth, dgabank, dgamem, vwidth, vheight;
unsigned char mypal[768];
int MyDepth;
int main(int argc, char *argv[])
{
return WolfMain(argc, argv);
}
static byte cpal[768];
static word spal[768];
static dword ipal[768];
/*
==========================
=
= Quit
=
==========================
*/
void DisplayTextSplash(byte *text, int l);
void Quit(char *error)
{
memptr screen = NULL;
int l = 0;
if (!error || !*error) {
CA_CacheGrChunk(ORDERSCREEN);
screen = grsegs[ORDERSCREEN];
l = 24;
WriteConfig();
} else if (error) {
CA_CacheGrChunk(ERRORSCREEN);
screen = grsegs[ERRORSCREEN];
l = 7;
}
ShutdownId();
if (screen) {
//printf("TODO: spiffy ansi screen goes here..\n");
DisplayTextSplash(screen, l);
}
if (error && *error) {
fprintf(stderr, "Quit: %s\n", error);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
/*
=======================
=
= VL_Startup
=
=======================
*/
int MyDepth;
void GetVisual()
{
......@@ -242,7 +192,7 @@ void VL_Startup()
root = RootWindow(dpy, screen);
GetVisual(); /* GetVisual will quit for us if no visual.. */
GetVisual();
attr.colormap = cmap;
attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask
......@@ -427,14 +377,6 @@ void VL_Startup()
XFlush(dpy);
#endif
/*
=======================
=
= VL_Shutdown
=
=======================
*/
void VL_Shutdown()
{
if (fullscreen) {
......@@ -491,7 +433,7 @@ void VW_UpdateScreen()
switch(vi->depth) {
case 8:
ptrb = dgabuf;
ptrbd = gfxbuf;
ptrbd = gfxbuf;
for(i = 0; i < 200; i++) {
memcpy(ptrb, ptrbd, 320);
ptrb += dgawidth;
......@@ -502,27 +444,27 @@ void VW_UpdateScreen()
case 15:
ptrs = (word *)disbuf;
for (i = 0; i < 64000; i++) {
*ptrs = (mypal[gfxbuf[i]*3+0] >> 1) << 10 |
(mypal[gfxbuf[i]*3+1] >> 1) << 5 |
(mypal[gfxbuf[i]*3+2] >> 1);
*ptrs = (cpal[gfxbuf[i]*3+0] >> 1) << 10 |
(cpal[gfxbuf[i]*3+1] >> 1) << 5 |
(cpal[gfxbuf[i]*3+2] >> 1);
ptrs++;
}
break;
case 16:
ptrs = (word *)disbuf;
for (i = 0; i < 64000; i++) {
*ptrs = (mypal[gfxbuf[i]*3+0] >> 1) << 11 |
(mypal[gfxbuf[i]*3+1] >> 0) << 5 |
(mypal[gfxbuf[i]*3+2] >> 1);
*ptrs = (cpal[gfxbuf[i]*3+0] >> 1) << 11 |
(cpal[gfxbuf[i]*3+1] >> 0) << 5 |
(cpal[gfxbuf[i]*3+2] >> 1);
ptrs++;
}
break;
case 24: /* not correct size */
ptrb = disbuf;
for (i = 0; i < 64000; i++) {
*ptrb = mypal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+0] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+0] << 2; ptrb++;
ptrb++;
}
break;
......@@ -534,35 +476,35 @@ void VW_UpdateScreen()
case 15:
ptrs = (word *)disbuf;
for (i = 0; i < 64000; i++) {
*ptrs = (mypal[gfxbuf[i]*3+0] >> 1) << 10 |
(mypal[gfxbuf[i]*3+1] >> 1) << 5 |
(mypal[gfxbuf[i]*3+2] >> 1);
*ptrs = (cpal[gfxbuf[i]*3+0] >> 1) << 10 |
(cpal[gfxbuf[i]*3+1] >> 1) << 5 |
(cpal[gfxbuf[i]*3+2] >> 1);
ptrs++;
}
break;
case 16:
ptrs = (word *)disbuf;
for (i = 0; i < 64000; i++) {
*ptrs = (mypal[gfxbuf[i]*3+0] >> 1) << 11 |
(mypal[gfxbuf[i]*3+1] >> 0) << 5 |
(mypal[gfxbuf[i]*3+2] >> 1);
*ptrs = (cpal[gfxbuf[i]*3+0] >> 1) << 11 |
(cpal[gfxbuf[i]*3+1] >> 0) << 5 |
(cpal[gfxbuf[i]*3+2] >> 1);
ptrs++;
}
break;
case 24:
ptrb = disbuf;
for (i = 0; i < 64000; i++) {
*ptrb = mypal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+0] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+0] << 2; ptrb++;
}
break;
case 32:
ptrb = disbuf;
for (i = 0; i < 64000; i++) {
*ptrb = mypal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = mypal[gfxbuf[i]*3+0] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+2] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+1] << 2; ptrb++;
*ptrb = cpal[gfxbuf[i]*3+0] << 2; ptrb++;
ptrb++;
}
break;
......@@ -575,6 +517,45 @@ void VW_UpdateScreen()
XPutImage(dpy, win, gc, img, 0, 0, 0, 0, 320, 200);
}
void keyboard_handler(int code, int press);
int XKeysymToScancode(KeySym keysym);
static void HandleXEvents()
{
XEvent event;
if (XPending(dpy)) {
do {
XNextEvent(dpy, &event);
switch(event.type) {
case KeyPress:
keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 1);
break;
case KeyRelease:
keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 0);
break;
case Expose:
VW_UpdateScreen();
break;
case ClientMessage:
if (event.xclient.data.l[0] == wmDeleteWindow)
Quit(NULL);
break;
case ConfigureNotify:
break;
case FocusIn:
break;
case FocusOut:
break;
default:
break;
}
} while (XPending(dpy));
}
}
/* ======================================================================== */
/*
=================
=
......@@ -598,14 +579,12 @@ void VL_FillPalette(int red, int green, int blue)
if (dga) XF86DGAInstallColormap(dpy, screen, cmap);
} else {
for (i = 0; i < 256; i++) {
mypal[i*3+0] = red;
mypal[i*3+1] = green;
mypal[i*3+2] = blue;
cpal[i*3+0] = red;
cpal[i*3+1] = green;
cpal[i*3+2] = blue;
}
}
}
//===========================================================================
}
/*
=================
......@@ -628,14 +607,11 @@ void VL_SetPalette(const byte *palette)
XStoreColors(dpy, cmap, clr, 256);
if (dga) XF86DGAInstallColormap(dpy, screen, cmap);
} else {
memcpy(mypal, palette, 768);
memcpy(cpal, palette, 768);
VW_UpdateScreen();
}
}
//===========================================================================
/*
=================
=
......@@ -655,10 +631,55 @@ void VL_GetPalette(byte *palette)
palette[i*3+2] = clr[i].blue >> 10;
}
} else {
memcpy(palette, mypal, 768);
memcpy(palette, cpal, 768);
}
}
int main(int argc, char *argv[])
{
return WolfMain(argc, argv);
}
/*
==========================
=
= Quit
=
==========================
*/
void DisplayTextSplash(byte *text, int l);
void Quit(char *error)
{
memptr screen = NULL;
int l = 0;
if (!error || !*error) {
CA_CacheGrChunk(ORDERSCREEN);
screen = grsegs[ORDERSCREEN];
l = 24;
WriteConfig();
} else if (error) {
CA_CacheGrChunk(ERRORSCREEN);
screen = grsegs[ERRORSCREEN];
l = 7;
}
ShutdownId();
if (screen) {
//printf("TODO: spiffy ansi screen goes here..\n");
DisplayTextSplash(screen, l);
}
if (error && *error) {
fprintf(stderr, "Quit: %s\n", error);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
/*
=============================================================================
......@@ -770,31 +791,6 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y)
}
}
void VL_DeModeXize(byte *buf, int width, int height)
{
byte *mem, *ptr, *destline;
int plane, x, y;
if (width & 3) {
printf("Not divisible by 4?\n");
return;
}
/* TODO: can this malloc be removed, and have this func swap each pixel? */
mem = malloc(width * height);
ptr = buf;
for (plane = 0; plane < 4; plane++) {
destline = mem;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 4; x++)
*(destline + x*4 + plane) = *ptr++;
destline += width;
}
}
memcpy(buf, mem, width * height);
free(mem);
}
void VL_DirectPlot(int x1, int y1, int x2, int y2)
{
if (dga) {
......@@ -814,9 +810,9 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
XColor c;
c.pixel = 0;
c.flags = DoRed|DoGreen|DoBlue;
c.red = mypal[pix*3+0] << 10;
c.green = mypal[pix*3+1] << 10;
c.blue = mypal[pix*3+2] << 10;
c.red = cpal[pix*3+0] << 10;
c.green = cpal[pix*3+1] << 10;
c.blue = cpal[pix*3+2] << 10;
XAllocColor(dpy, cmap, &c);
XSetForeground(dpy, gc, c.pixel);
XDrawPoint(dpy, win, gc, x2, y2);
......@@ -884,14 +880,14 @@ static boolean IN_Started;
static boolean CapsLock;
static ScanCode CurCode,LastCode;
static Direction DirTable[] = // Quick lookup for total direction
{
dir_NorthWest, dir_North, dir_NorthEast,
dir_West, dir_None, dir_East,
dir_SouthWest, dir_South, dir_SouthEast
};
static Direction DirTable[] = // Quick lookup for total direction
{
dir_NorthWest, dir_North, dir_NorthEast,
dir_West, dir_None, dir_East,
dir_SouthWest, dir_South, dir_SouthEast
};
int XKeysymToScancode(unsigned int keysym)
int XKeysymToScancode(KeySym keysym)
{
switch (keysym) {
case XK_1:
......@@ -902,12 +898,20 @@ int XKeysymToScancode(unsigned int keysym)
return sc_3;
case XK_4:
return sc_4;
case XK_5:
return sc_5;
case XK_6:
return sc_6;
case XK_a:
return sc_A;
case XK_b:
return sc_B;
case XK_c:
return sc_C;
case XK_d:
return sc_D;
case XK_g:
return sc_G;
case XK_h:
return sc_H;
case XK_i:
......@@ -918,10 +922,26 @@ int XKeysymToScancode(unsigned int keysym)
return sc_M;
case XK_n:
return sc_N;
case XK_q:
return sc_Q;
case XK_s:
return sc_S;
case XK_t:
return sc_T;
case XK_y:
return sc_Y;
case XK_F1:
return sc_F1;
case XK_F2:
return sc_F2;
case XK_F3:
return sc_F3;
case XK_F10:
return sc_F10;
case XK_F11:
return sc_F11;
case XK_F12:
return sc_F12;
case XK_Left:
case XK_KP_Left:
return sc_LeftArrow;
......@@ -935,8 +955,10 @@ int XKeysymToScancode(unsigned int keysym)
case XK_KP_Down:
return sc_DownArrow;
case XK_Control_L:
case XK_Control_R:
return sc_Control;
case XK_Alt_L:
case XK_Alt_R:
return sc_Alt;
case XK_Shift_L:
return sc_LShift;
......@@ -968,7 +990,7 @@ void keyboard_handler(int code, int press)
k = code;
if (k == 0xe1) // Handle Pause key
if (k == 0xE1) // Handle Pause key
Paused = true;
else
{
......@@ -1311,37 +1333,14 @@ void IN_StartAck(void)
boolean IN_CheckAck()
{
XEvent event;
unsigned i, buttons;
if (XPending(dpy)) {
do {
XNextEvent(dpy, &event);
switch(event.type) {
case KeyPress:
keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 1);
break;
case KeyRelease:
keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 0);
break;
case Expose:
VW_UpdateScreen();
break;
case ClientMessage:
if (event.xclient.data.l[0] == wmDeleteWindow)
Quit(NULL);
break;
default:
break;
}
} while (XPending(dpy));
}
HandleXEvents();
if (LastScan)
return true;
buttons = IN_JoyButtons () << 4;
buttons = IN_JoyButtons() << 4;
if (MousePresent)
buttons |= IN_MouseButtons ();
......
......@@ -294,8 +294,8 @@ void T_Projectile (objtype *ob)
ob->x += deltax;
ob->y += deltay;
deltax = LABS(ob->x - player->x);
deltay = LABS(ob->y - player->y);
deltax = labs(ob->x - player->x);
deltay = labs(ob->y - player->y);
if (!ProjectileTryMove (ob))
{
......@@ -3289,11 +3289,11 @@ void T_DogChase (objtype *ob)
===============
*/
void SelectPathDir (objtype *ob)
void SelectPathDir(objtype *ob)
{
unsigned spot;
spot = MAPSPOT(ob->tilex,ob->tiley,1)-ICONARROWS;
spot = *(mapsegs[1]+farmapylookup[ob->tiley]+ob->tilex)-ICONARROWS;
if (spot<8)
{
......
......@@ -6,18 +6,6 @@
#include "wl_menu.h"
#include "foreign.h"
/*
=============================================================================
MACROS
=============================================================================
*/
#define MAPSPOT(x,y,plane) (*(mapsegs[plane]+farmapylookup[y]+x))
#define LABS(x) ((long)(x)>0?(x):-(x))
/*
=============================================================================
......
......@@ -456,15 +456,14 @@ void SetupGameLevel()
int x,y;
word *map,tile;
if (!loadedgame)
{
gamestate.TimeCount=
gamestate.secrettotal=
gamestate.killtotal=
gamestate.treasuretotal=
gamestate.secretcount=
gamestate.killcount=
gamestate.treasurecount=0;
if (!loadedgame) {
gamestate.TimeCount =
gamestate.secrettotal =
gamestate.killtotal =
gamestate.treasuretotal =
gamestate.secretcount =
gamestate.killcount =
gamestate.treasurecount = 0;
}
if (demoplayback || demorecord)
......@@ -476,12 +475,9 @@ void SetupGameLevel()
// load the level
//
CA_CacheMap(gamestate.mapon+10*gamestate.episode);
mapon-=gamestate.episode*10;
mapwidth = mapheaderseg[mapon]->width;
mapheight = mapheaderseg[mapon]->height;
mapon -= gamestate.episode*10;
if (mapwidth != 64 || mapheight != 64)
if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64))
Quit("Map not 64*64!");
......@@ -492,14 +488,13 @@ void SetupGameLevel()
memset(actorat, 0, sizeof(actorat));
map = mapsegs[0];
for (y=0;y<mapheight;y++)
for (x=0;x<mapwidth;x++)
{
for (y = 0; y < mapheight; y++)
for (x = 0; x < mapwidth; x++) {
tile = *map++;
if (tile<AREATILE) { // solid wall
if (tile < AREATILE) { /* solid wall */
tilemap[x][y] = tile;
(unsigned)actorat[x][y] = tile;
} else { // area floor
} else { /* area floor */
tilemap[x][y] = 0;
actorat[x][y] = NULL;
}
......@@ -558,7 +553,7 @@ void SetupGameLevel()
if (tile == AMBUSHTILE)
{
tilemap[x][y] = 0;
if ( (unsigned)actorat[x][y] == AMBUSHTILE)
if ((unsigned)actorat[x][y] == AMBUSHTILE)
actorat[x][y] = NULL;
if (*map >= AREATILE)
......@@ -567,7 +562,7 @@ void SetupGameLevel()
tile = *(map-1-mapwidth);
if (*(map-1+mapwidth) >= AREATILE)
tile = *(map-1+mapwidth);
if ( *(map-2) >= AREATILE)
if (*(map-2) >= AREATILE)
tile = *(map-2);
*(map-1) = tile;
......
......@@ -149,8 +149,9 @@ CusMenu[]=
static int color_hlite[] = { DEACTIVE, HIGHLIGHT, READHCOLOR, 0x67 };
static int color_norml[] = { DEACTIVE, TEXTCOLOR, READCOLOR, 0x6b };
static int EpisodeSelect[6]={1};
#ifndef SPEAR
static int EpisodeSelect[6] = { 1 };
#endif
int SaveGamesAvail[10],StartGame,SoundStatus=1,pickquick;
char SaveGameNames[10][32],SaveName[13]="savegam?.";
......
......@@ -26,10 +26,7 @@ byte tilemap[MAPSIZE][MAPSIZE]; // wall values only
byte spotvis[MAPSIZE][MAPSIZE];
objtype *actorat[MAPSIZE][MAPSIZE];
//
// replacing refresh manager
//
unsigned mapwidth,mapheight,tics;
unsigned tics;
//
// control info
......@@ -345,7 +342,7 @@ void PollKeyboardMove()
void PollMouseMove()
{
int mousexmove = 0, mouseymove = 0;
int mousexmove = 0, mouseymove = 0;
controlx += mousexmove*10/(13-mouseadjustment);
controly += mouseymove*20/(13-mouseadjustment);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment