Commit 46f35dd2 authored by Steven Fuller's avatar Steven Fuller

More cleanups.

Removed the unnecessary third parameters to some calls to open().

Removed some unused code.

Rewrote CAL_CarmackExpand to prevent problems with unaligned access.

Changed direct access to the Keyboard array to use a macro IN_KeyDown()
(which could one day become a function).
parent f1995e1d
...@@ -3,8 +3,8 @@ CC = gcc ...@@ -3,8 +3,8 @@ CC = gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
CFLAGS = -g -Wall CFLAGS = -g -Wall
#CFLAGS = -g #CFLAGS = -Os -Wall
#CFLAGS = -Os #CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include #CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \ OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
......
This diff is collapsed.
...@@ -48,7 +48,6 @@ boolean CA_ReadFile(char *filename, memptr *ptr); ...@@ -48,7 +48,6 @@ boolean CA_ReadFile(char *filename, memptr *ptr);
boolean CA_LoadFile(char *filename, memptr *ptr); boolean CA_LoadFile(char *filename, memptr *ptr);
boolean CA_WriteFile(char *filename, void *ptr, long length); boolean CA_WriteFile(char *filename, void *ptr, long length);
long CA_RLEWCompress(word *source, long length, word *dest, word rlewtag);
void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag); void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag);
void CA_Startup (void); void CA_Startup (void);
...@@ -78,7 +77,7 @@ void CA_CacheMarks(); ...@@ -78,7 +77,7 @@ void CA_CacheMarks();
void CA_CacheScreen(int chunk); void CA_CacheScreen(int chunk);
//========================================================================== /* ======================================================================= */
void MM_Startup(); void MM_Startup();
void MM_Shutdown(); void MM_Shutdown();
......
#ifndef __VI_COMM_H__ #ifndef __VI_COMM_H__
#define __VI_COMM_H__ #define __VI_COMM_H__
//=========================================================================== /* ======================================================================== */
extern byte *gfxbuf; extern byte *gfxbuf;
...@@ -32,14 +32,15 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2); ...@@ -32,14 +32,15 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2);
#define MaxJoys 2 #define MaxJoys 2
#define NumCodes 128 #define NumCodes 128
typedef byte ScanCode; typedef byte ScanCode;
#define sc_None 0 #define sc_None 0
#define sc_Bad 0xff #define sc_Bad 0xff
#define sc_Return 0x1c #define sc_Return 0x1c
#define sc_Enter sc_Return #define sc_Enter sc_Return
#define sc_Escape 0x01 #define sc_Escape 0x01
#define sc_Space 0x39 #define sc_Space 0x39
#define sc_BackSpace 0x0e #define sc_BackSpace 0x0e
#define sc_Tab 0x0f #define sc_Tab 0x0f
#define sc_Alt 0x38 #define sc_Alt 0x38
#define sc_Control 0x1d #define sc_Control 0x1d
...@@ -47,7 +48,7 @@ typedef byte ScanCode; ...@@ -47,7 +48,7 @@ typedef byte ScanCode;
#define sc_LShift 0x2a #define sc_LShift 0x2a
#define sc_RShift 0x36 #define sc_RShift 0x36
/* TODO: have all these defines map into system specific values */ /* TODO */
/* /*
#define sc_UpArrow 0x48 #define sc_UpArrow 0x48
#define sc_DownArrow 0x50 #define sc_DownArrow 0x50
...@@ -123,41 +124,49 @@ typedef byte ScanCode; ...@@ -123,41 +124,49 @@ typedef byte ScanCode;
#define key_None 0 #define key_None 0
typedef enum { typedef enum {
ctrl_Keyboard, ctrl_Keyboard,
ctrl_Joystick, ctrl_Joystick,
ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, ctrl_Joystick1 = ctrl_Joystick,
ctrl_Mouse ctrl_Joystick2,
} ControlType; ctrl_Mouse
typedef enum { } ControlType;
motion_Left = -1,motion_Up = -1,
motion_None = 0, typedef enum {
motion_Right = 1,motion_Down = 1 motion_Left = -1,
} Motion; motion_Up = -1,
typedef enum { motion_None = 0,
dir_North,dir_NorthEast, motion_Right = 1,
dir_East,dir_SouthEast, motion_Down = 1
dir_South,dir_SouthWest, } Motion;
dir_West,dir_NorthWest,
dir_None typedef enum {
} Direction; dir_North,
typedef struct { dir_NorthEast,
boolean button0,button1,button2,button3; dir_East,
int x,y; dir_SouthEast,
Motion xaxis,yaxis; dir_South,
Direction dir; dir_SouthWest,
} CursorInfo; dir_West,
typedef CursorInfo ControlInfo; dir_NorthWest,
typedef struct { dir_None
ScanCode button0,button1, } Direction;
upleft, up, upright,
left, right, typedef struct {
downleft, down, downright; boolean button0, button1, button2, button3;
} KeyboardDef; int x, y;
Motion xaxis, yaxis;
Direction dir;
} ControlInfo;
typedef struct {
ScanCode button0, button1, upleft, up, upright,
left, right, downleft, down, downright;
} KeyboardDef;
// Global variables // Global variables
extern boolean Keyboard[], extern boolean Keyboard[], MousePresent, JoysPresent[];
MousePresent,
JoysPresent[];
extern boolean Paused; extern boolean Paused;
extern char LastASCII; extern char LastASCII;
extern ScanCode LastScan; extern ScanCode LastScan;
...@@ -166,25 +175,28 @@ extern ControlType Controls[MaxPlayers]; ...@@ -166,25 +175,28 @@ extern ControlType Controls[MaxPlayers];
// Function prototypes // Function prototypes
#define IN_KeyDown(code) (Keyboard[(code)]) #define IN_KeyDown(code) (Keyboard[(code)])
#define IN_ClearKey(code) {Keyboard[code] = false; \ #define IN_ClearKey(code) { \
if (code == LastScan) LastScan = sc_None;} Keyboard[code] = false; \
if (code == LastScan) \
extern void IN_Startup(void),IN_Shutdown(void), LastScan = sc_None; \
IN_ClearKeysDown(void), }
IN_ReadControl(int,ControlInfo *),
IN_GetJoyAbs(word joy,word *xp,word *yp), extern void IN_Startup(void),IN_Shutdown(void),
IN_SetupJoy(word joy,word minx,word maxx, IN_ClearKeysDown(void),
word miny,word maxy), IN_ReadControl(int,ControlInfo *),
IN_Ack(void); IN_GetJoyAbs(word joy,word *xp,word *yp),
extern boolean IN_UserInput(longword delay); IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy),
extern byte *IN_GetScanName(ScanCode); IN_Ack(void);
extern boolean IN_UserInput(longword delay);
byte IN_MouseButtons (void); extern char *IN_GetScanName(ScanCode);
byte IN_JoyButtons (void);
byte IN_MouseButtons();
byte IN_JoyButtons();
void INL_GetJoyDelta(word joy,int *dx,int *dy); void INL_GetJoyDelta(word joy,int *dx,int *dy);
void IN_StartAck(void); void IN_StartAck();
boolean IN_CheckAck (void); boolean IN_CheckAck();
#endif #endif
...@@ -313,18 +313,18 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2) ...@@ -313,18 +313,18 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
// //
// configuration variables // configuration variables
// //
boolean MousePresent; boolean MousePresent;
boolean JoysPresent[MaxJoys]; boolean JoysPresent[MaxJoys];
// Global variables // Global variables
boolean Keyboard[NumCodes]; boolean Keyboard[NumCodes];
boolean Paused; boolean Paused;
char LastASCII; char LastASCII;
ScanCode LastScan; ScanCode LastScan;
KeyboardDef KbdDefs = {sc_Control, sc_Alt, sc_Home, sc_UpArrow, sc_PgUp, sc_LeftArrow, sc_RightArrow, sc_End, sc_DownArrow, sc_PgDn}; KeyboardDef KbdDefs = {sc_Control, sc_Alt, sc_Home, sc_UpArrow, sc_PgUp, sc_LeftArrow, sc_RightArrow, sc_End, sc_DownArrow, sc_PgDn};
ControlType Controls[MaxPlayers]; ControlType Controls[MaxPlayers];
/* /*
============================================================================= =============================================================================
...@@ -362,14 +362,11 @@ static boolean IN_Started; ...@@ -362,14 +362,11 @@ static boolean IN_Started;
static boolean CapsLock; static boolean CapsLock;
static ScanCode CurCode,LastCode; static ScanCode CurCode,LastCode;
static Direction DirTable[] = // Quick lookup for total direction static Direction DirTable[] = { // Quick lookup for total direction
{ dir_NorthWest, dir_North, dir_NorthEast,
dir_NorthWest, dir_North, dir_NorthEast, dir_West, dir_None, dir_East,
dir_West, dir_None, dir_East, dir_SouthWest, dir_South, dir_SouthEast
dir_SouthWest, dir_South, dir_SouthEast };
};
// Internal routines
void keyboard_handler(int code, int press) void keyboard_handler(int code, int press)
{ {
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
*/ */
statobj_t statobjlist[MAXSTATS],*laststatobj; statobj_t statobjlist[MAXSTATS], *laststatobj;
struct struct
{ {
int picnum; int picnum;
stat_t type; stat_t type;
} statinfo[] = } statinfo[] =
{ {
...@@ -120,13 +120,11 @@ struct ...@@ -120,13 +120,11 @@ struct
=============== ===============
*/ */
void InitStaticList (void) void InitStaticList()
{ {
laststatobj = &statobjlist[0]; laststatobj = &statobjlist[0];
} }
/* /*
=============== ===============
= =
...@@ -135,7 +133,7 @@ void InitStaticList (void) ...@@ -135,7 +133,7 @@ void InitStaticList (void)
=============== ===============
*/ */
void SpawnStatic (int tilex, int tiley, int type) void SpawnStatic(int tilex, int tiley, int type)
{ {
laststatobj->shapenum = statinfo[type].picnum; laststatobj->shapenum = statinfo[type].picnum;
laststatobj->tilex = tilex; laststatobj->tilex = tilex;
...@@ -197,15 +195,15 @@ void SpawnStatic (int tilex, int tiley, int type) ...@@ -197,15 +195,15 @@ void SpawnStatic (int tilex, int tiley, int type)
=============== ===============
*/ */
void PlaceItemType (int itemtype, int tilex, int tiley) void PlaceItemType(int itemtype, int tilex, int tiley)
{ {
int type; int type;
statobj_t *spot; statobj_t *spot;
// //
// find the item number // find the item number
// //
for (type=0 ; ; type++) for (type = 0; ; type++)
{ {
if (statinfo[type].picnum == -1) /* end of list */ if (statinfo[type].picnum == -1) /* end of list */
Quit("PlaceItemType: couldn't find type!"); Quit("PlaceItemType: couldn't find type!");
...@@ -291,32 +289,32 @@ boolean areabyplayer[NUMAREAS]; ...@@ -291,32 +289,32 @@ boolean areabyplayer[NUMAREAS];
============== ==============
*/ */
void RecursiveConnect (int areanumber) void RecursiveConnect(int areanumber)
{ {
int i; int i;
for (i=0;i<NUMAREAS;i++) for (i = 0; i < NUMAREAS; i++)
{ {
if (areaconnect[areanumber][i] && !areabyplayer[i]) if (areaconnect[areanumber][i] && !areabyplayer[i])
{ {
areabyplayer[i] = true; areabyplayer[i] = true;
RecursiveConnect (i); RecursiveConnect(i);
} }
} }
} }
void ConnectAreas (void) void ConnectAreas()
{ {
memset (areabyplayer,0,sizeof(areabyplayer)); memset(areabyplayer, 0, sizeof(areabyplayer));
areabyplayer[player->areanumber] = true; areabyplayer[player->areanumber] = true;
RecursiveConnect (player->areanumber); RecursiveConnect(player->areanumber);
} }
void InitAreas (void) void InitAreas()
{ {
memset (areabyplayer,0,sizeof(areabyplayer)); memset(areabyplayer, 0, sizeof(areabyplayer));
areabyplayer[player->areanumber] = true; areabyplayer[player->areanumber] = true;
} }
...@@ -330,7 +328,7 @@ void InitAreas (void) ...@@ -330,7 +328,7 @@ void InitAreas (void)
=============== ===============
*/ */
void InitDoorList (void) void InitDoorList()
{ {
memset (areabyplayer,0,sizeof(areabyplayer)); memset (areabyplayer,0,sizeof(areabyplayer));
memset (areaconnect,0,sizeof(areaconnect)); memset (areaconnect,0,sizeof(areaconnect));
...@@ -348,11 +346,11 @@ void InitDoorList (void) ...@@ -348,11 +346,11 @@ void InitDoorList (void)
=============== ===============
*/ */
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock) void SpawnDoor(int tilex, int tiley, boolean vertical, int lock)
{ {
word *map; word *map;
if (doornum==64) if (doornum == 64)
Quit ("64+ doors on level!"); Quit ("64+ doors on level!");
doorposition[doornum] = 0; // doors start out fully closed doorposition[doornum] = 0; // doors start out fully closed
......
...@@ -277,19 +277,19 @@ int DebugKeys() ...@@ -277,19 +277,19 @@ int DebugKeys()
boolean esc; boolean esc;
int level; int level;
if (Keyboard[sc_C]) // C = count objects if (IN_KeyDown(sc_C)) // C = count objects
{ {
CountObjects(); CountObjects();
return 1; return 1;
} }
if (Keyboard[sc_E]) // E = quit level if (IN_KeyDown(sc_E)) // E = quit level
{ {
playstate = ex_completed; playstate = ex_completed;
// gamestate.mapon++; // gamestate.mapon++;
} }
if (Keyboard[sc_F]) // F = facing spot if (IN_KeyDown(sc_F)) // F = facing spot
{ {
CenterWindow (14,4); CenterWindow (14,4);
US_Print ("X:"); US_Print ("X:");
...@@ -303,7 +303,7 @@ int DebugKeys() ...@@ -303,7 +303,7 @@ int DebugKeys()
return 1; return 1;
} }
if (Keyboard[sc_G]) // G = god mode if (IN_KeyDown(sc_G)) // G = god mode
{ {
CenterWindow (12,2); CenterWindow (12,2);
if (godmode) if (godmode)
...@@ -315,12 +315,12 @@ int DebugKeys() ...@@ -315,12 +315,12 @@ int DebugKeys()
godmode ^= 1; godmode ^= 1;
return 1; return 1;
} }
if (Keyboard[sc_H]) // H = hurt self if (IN_KeyDown(sc_H)) // H = hurt self
{ {
IN_ClearKeysDown (); IN_ClearKeysDown ();
TakeDamage (16,NULL); TakeDamage (16,NULL);
} }
else if (Keyboard[sc_I]) // I = item cheat else if (IN_KeyDown(sc_I)) // I = item cheat
{ {
CenterWindow (12,3); CenterWindow (12,3);
US_PrintCentered ("Free items!"); US_PrintCentered ("Free items!");
...@@ -336,7 +336,7 @@ int DebugKeys() ...@@ -336,7 +336,7 @@ int DebugKeys()
IN_Ack (); IN_Ack ();
return 1; return 1;
} }
else if (Keyboard[sc_N]) // N = no clip else if (IN_KeyDown(sc_N)) // N = no clip
{ {
noclip^=1; noclip^=1;
CenterWindow (18,3); CenterWindow (18,3);
...@@ -348,14 +348,14 @@ int DebugKeys() ...@@ -348,14 +348,14 @@ int DebugKeys()
IN_Ack (); IN_Ack ();
return 1; return 1;
} }
else if (Keyboard[sc_P]) // P = pause with no screen disruptioon else if (IN_KeyDown(sc_P)) // P = pause with no screen disruptioon
{ {
PicturePause (); PicturePause ();
return 1; return 1;
} }
else if (Keyboard[sc_Q]) // Q = fast quit else if (IN_KeyDown(sc_Q)) // Q = fast quit
Quit(NULL); Quit(NULL);
else if (Keyboard[sc_S]) // S = slow motion else if (IN_KeyDown(sc_S)) // S = slow motion
{ {
singlestep^=1; singlestep^=1;
CenterWindow (18,3); CenterWindow (18,3);
...@@ -367,12 +367,12 @@ int DebugKeys() ...@@ -367,12 +367,12 @@ int DebugKeys()
IN_Ack (); IN_Ack ();
return 1; return 1;
} }
else if (Keyboard[sc_T]) // T = shape test else if (IN_KeyDown(sc_T)) // T = shape test
{ {
ShapeTest (); ShapeTest();
return 1; return 1;
} }
else if (Keyboard[sc_V]) // V = extra VBLs else if (IN_KeyDown(sc_V)) // V = extra VBLs
{ {
CenterWindow(30,3); CenterWindow(30,3);
PrintY+=6; PrintY+=6;
...@@ -387,11 +387,10 @@ int DebugKeys() ...@@ -387,11 +387,10 @@ int DebugKeys()
} }
return 1; return 1;
} }
else if (Keyboard[sc_W]) // W = warp to level else if (IN_KeyDown(sc_W)) // W = warp to level
{ {
CenterWindow(26,3); CenterWindow(26,3);
PrintY+=6; PrintY+=6;
/* TODO: wouldn't work on sod demo etc */
#ifndef SPEAR #ifndef SPEAR
US_Print(" Warp to which level(1-10):"); US_Print(" Warp to which level(1-10):");
#elif defined(SPEARDEMO) #elif defined(SPEARDEMO)
......
...@@ -224,7 +224,7 @@ void Victory (void) ...@@ -224,7 +224,7 @@ void Victory (void)
IN_Ack(); IN_Ack();
#ifndef SPEAR #ifndef SPEAR
if (Keyboard[sc_P] && MS_CheckParm("goobers")) if (IN_KeyDown(sc_P) && MS_CheckParm("goobers"))
PicturePause(); PicturePause();
#endif #endif
...@@ -833,7 +833,7 @@ void LevelCompleted() ...@@ -833,7 +833,7 @@ void LevelCompleted()
#endif #endif
#ifndef SPEAR #ifndef SPEAR
if (Keyboard[sc_P] && MS_CheckParm("goobers")) if (IN_KeyDown(sc_P) && MS_CheckParm("goobers"))
PicturePause(); PicturePause();
#endif #endif
......
...@@ -1095,8 +1095,8 @@ void InitGame(void) ...@@ -1095,8 +1095,8 @@ void InitGame(void)
// HOLDING DOWN 'M' KEY? // HOLDING DOWN 'M' KEY?
// //
#ifndef SPEARDEMO #ifndef SPEARDEMO
if (Keyboard[sc_M]) if (IN_KeyDown(sc_M))
DoJukebox(); DoJukebox();
else else
#endif #endif
...@@ -1190,7 +1190,7 @@ void NewViewSize(int width) ...@@ -1190,7 +1190,7 @@ void NewViewSize(int width)
===================== =====================
*/ */
void DemoLoop (void) void DemoLoop()
{ {
static int LastDemo; static int LastDemo;
...@@ -1211,7 +1211,7 @@ void DemoLoop (void) ...@@ -1211,7 +1211,7 @@ void DemoLoop (void)
PG13 (); PG13 ();
i = MS_CheckParm("playdemo"); i = MS_CheckParm("playdemo");
if ( i && ( (i+1) < _argc) ) { if (i && ((i+1) < _argc)) {
i++; i++;
for (; i < _argc; i++) { for (; i < _argc; i++) {
if (_argv[i][0] == '-') if (_argv[i][0] == '-')
...@@ -1240,8 +1240,8 @@ void DemoLoop (void) ...@@ -1240,8 +1240,8 @@ void DemoLoop (void)
CA_CacheGrChunk (TITLE2PIC); CA_CacheGrChunk (TITLE2PIC);
VWB_DrawPic (0,80,TITLE2PIC); VWB_DrawPic (0,80,TITLE2PIC);
CA_UnCacheGrChunk (TITLE2PIC); CA_UnCacheGrChunk(TITLE2PIC);
VW_UpdateScreen (); VW_UpdateScreen();
VL_FadeIn(0,255,grsegs[TITLEPALETTE],30); VL_FadeIn(0,255,grsegs[TITLEPALETTE],30);
CA_UnCacheGrChunk (TITLEPALETTE); CA_UnCacheGrChunk (TITLEPALETTE);
...@@ -1288,7 +1288,7 @@ void DemoLoop (void) ...@@ -1288,7 +1288,7 @@ void DemoLoop (void)
VW_FadeOut (); VW_FadeOut ();
if (Keyboard[sc_Tab] && MS_CheckParm("debugmode")) if (IN_KeyDown(sc_Tab) && MS_CheckParm("debugmode"))
RecordDemo (); RecordDemo ();
else else
US_ControlPanel (0); US_ControlPanel (0);
......
This diff is collapsed.
...@@ -84,25 +84,25 @@ ...@@ -84,25 +84,25 @@
#define CST_X 20 #define CST_X 20
#define CST_Y 48 #define CST_Y 48
#define CST_START 60 #define CST_START 60
#define CST_SPC 60 #define CST_SPC 60
// //
// TYPEDEFS // TYPEDEFS
// //
typedef struct { typedef struct {
int x,y,amount,curpos,indent; int x,y,amount,curpos,indent;
} CP_iteminfo; } CP_iteminfo;
typedef struct { typedef struct {
int active; int active;
char string[36]; char string[36];
void (* routine)(int temp1); void (* routine)(int temp1);
} CP_itemtype; } CP_itemtype;
typedef struct { typedef struct {
int allowed[4]; int allowed[4];
} CustomCtrls; } CustomCtrls;
extern CP_itemtype MainMenu[], NewEMenu[]; extern CP_itemtype MainMenu[], NewEMenu[];
extern CP_iteminfo MainItems; extern CP_iteminfo MainItems;
...@@ -114,9 +114,7 @@ void SetupControlPanel(void); ...@@ -114,9 +114,7 @@ void SetupControlPanel(void);
void CleanupControlPanel(void); void CleanupControlPanel(void);
void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items);
int HandleMenu(CP_iteminfo *item_i, int HandleMenu(CP_iteminfo *item_i, CP_itemtype *items, void (*routine)(int w));
CP_itemtype *items,
void (*routine)(int w));
void ClearMScreen(void); void ClearMScreen(void);
void DrawWindow(int x,int y,int w,int h,int wcolor); void DrawWindow(int x,int y,int w,int h,int wcolor);
void DrawOutline(int x,int y,int w,int h,int color1,int color2); void DrawOutline(int x,int y,int w,int h,int color1,int color2);
...@@ -214,13 +212,13 @@ enum ...@@ -214,13 +212,13 @@ enum
// WL_INTER // WL_INTER
// //
typedef struct { typedef struct {
int kill,secret,treasure; int kill,secret,treasure;
long time; long time;
} LRstruct; } LRstruct;
extern LRstruct LevelRatios[]; extern LRstruct LevelRatios[];
void Write (int x,int y,char *string); void Write(int x,int y,char *string);
int GetYorN(int x,int y,int pic); int GetYorN(int x,int y,int pic);
#endif #endif
...@@ -244,7 +244,7 @@ void PollKeyboardButtons (void) ...@@ -244,7 +244,7 @@ void PollKeyboardButtons (void)
int i; int i;
for (i=0;i<NUMBUTTONS;i++) for (i=0;i<NUMBUTTONS;i++)
if (Keyboard[buttonscan[i]]) if (IN_KeyDown(buttonscan[i]))
buttonstate[i] = true; buttonstate[i] = true;
} }
...@@ -319,28 +319,28 @@ void PollJoystickButtons (void) ...@@ -319,28 +319,28 @@ void PollJoystickButtons (void)
=================== ===================
*/ */
void PollKeyboardMove (void) void PollKeyboardMove()
{ {
if (buttonstate[bt_run]) if (buttonstate[bt_run])
{ {
if (Keyboard[dirscan[di_north]]) if (IN_KeyDown(dirscan[di_north]))
controly -= RUNMOVE*tics; controly -= RUNMOVE*tics;
if (Keyboard[dirscan[di_south]]) if (IN_KeyDown(dirscan[di_south]))
controly += RUNMOVE*tics; controly += RUNMOVE*tics;
if (Keyboard[dirscan[di_west]]) if (IN_KeyDown(dirscan[di_west]))
controlx -= RUNMOVE*tics; controlx -= RUNMOVE*tics;
if (Keyboard[dirscan[di_east]]) if (IN_KeyDown(dirscan[di_east]))
controlx += RUNMOVE*tics; controlx += RUNMOVE*tics;
} }
else else
{ {
if (Keyboard[dirscan[di_north]]) if (IN_KeyDown(dirscan[di_north]))
controly -= BASEMOVE*tics; controly -= BASEMOVE*tics;
if (Keyboard[dirscan[di_south]]) if (IN_KeyDown(dirscan[di_south]))
controly += BASEMOVE*tics; controly += BASEMOVE*tics;
if (Keyboard[dirscan[di_west]]) if (IN_KeyDown(dirscan[di_west]))
controlx -= BASEMOVE*tics; controlx -= BASEMOVE*tics;
if (Keyboard[dirscan[di_east]]) if (IN_KeyDown(dirscan[di_east]))
controlx += BASEMOVE*tics; controlx += BASEMOVE*tics;
} }
} }
...@@ -590,10 +590,7 @@ void CheckKeys (void) ...@@ -590,10 +590,7 @@ void CheckKeys (void)
// //
// SECRET CHEAT CODE: TAB-G-F10 // SECRET CHEAT CODE: TAB-G-F10
// //
if (Keyboard[sc_Tab] && if (IN_KeyDown(sc_Tab) && IN_KeyDown(sc_G) && IN_KeyDown(sc_F10)) {
Keyboard[sc_G] &&
Keyboard[sc_F10])
{
WindowH = 160; WindowH = 160;
if (godmode) if (godmode)
{ {
...@@ -616,16 +613,13 @@ void CheckKeys (void) ...@@ -616,16 +613,13 @@ void CheckKeys (void)
// //
// SECRET CHEAT CODE: 'MLI' // SECRET CHEAT CODE: 'MLI'
// //
if (Keyboard[sc_M] && if (IN_KeyDown(sc_M) && IN_KeyDown(sc_L) && IN_KeyDown(sc_I)) {
Keyboard[sc_L] &&
Keyboard[sc_I])
{
gamestate.health = 100; gamestate.health = 100;
gamestate.ammo = 99; gamestate.ammo = 99;
gamestate.keys = 3; gamestate.keys = 3;
gamestate.score = 0; gamestate.score = 0;
gamestate.TimeCount += 42000L; gamestate.TimeCount += 42000L;
GiveWeapon (wp_chaingun); GiveWeapon(wp_chaingun);
DrawWeapon(); DrawWeapon();
DrawHealth(); DrawHealth();
...@@ -653,11 +647,8 @@ void CheckKeys (void) ...@@ -653,11 +647,8 @@ void CheckKeys (void)
// //
// OPEN UP DEBUG KEYS // OPEN UP DEBUG KEYS
// //
if (Keyboard[sc_BackSpace] && if (IN_KeyDown(sc_BackSpace) && IN_KeyDown(sc_LShift) &&
Keyboard[sc_LShift] && IN_KeyDown(sc_Alt) && MS_CheckParm("debugmode")) {
Keyboard[sc_Alt] &&
MS_CheckParm("debugmode"))
{
ClearMemory (); ClearMemory ();
CA_CacheGrChunk (STARTFONT+1); CA_CacheGrChunk (STARTFONT+1);
ClearSplitVWB (); ClearSplitVWB ();
...@@ -674,35 +665,32 @@ void CheckKeys (void) ...@@ -674,35 +665,32 @@ void CheckKeys (void)
// //
// TRYING THE KEEN CHEAT CODE! // TRYING THE KEEN CHEAT CODE!
// //
if (Keyboard[sc_B] && if (IN_KeyDown(sc_B) && IN_KeyDown(sc_A) && IN_KeyDown(sc_T)) {
Keyboard[sc_A] && ClearMemory();
Keyboard[sc_T]) CA_CacheGrChunk(STARTFONT+1);
{ ClearSplitVWB();
ClearMemory ();
CA_CacheGrChunk (STARTFONT+1);
ClearSplitVWB ();
Message("Commander Keen is also\n" Message("Commander Keen is also\n"
"available from Apogee, but\n" "available from Apogee, but\n"
"then, you already know\n" "then, you already know\n"
"that - right, Cheatmeister?!"); "that - right, Cheatmeister?!");
CA_UnCacheGrChunk(STARTFONT+1); CA_UnCacheGrChunk(STARTFONT+1);
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
DrawAllPlayBorder (); DrawAllPlayBorder();
} }
if (Paused) if (Paused) {
{
VWB_DrawPic(128, 64, PAUSEDPIC); VWB_DrawPic(128, 64, PAUSEDPIC);
VW_UpdateScreen(); VW_UpdateScreen();
SD_MusicOff(); SD_MusicOff();
IN_Ack(); IN_Ack();
IN_ClearKeysDown (); IN_ClearKeysDown();
SD_MusicOn(); SD_MusicOn();
Paused = false; Paused = false;
return; return;
} }
...@@ -759,8 +747,7 @@ void CheckKeys (void) ...@@ -759,8 +747,7 @@ void CheckKeys (void)
// //
// TAB-? debug keys // TAB-? debug keys
// //
if (Keyboard[sc_Tab] && DebugOk) if (IN_KeyDown(sc_Tab) && DebugOk) {
{
CA_CacheGrChunk (STARTFONT); CA_CacheGrChunk (STARTFONT);
fontnumber=0; fontnumber=0;
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
......
...@@ -86,60 +86,6 @@ void SetupScaling(int maxscaleheight) ...@@ -86,60 +86,6 @@ void SetupScaling(int maxscaleheight)
//=========================================================================== //===========================================================================
/*
========================
=
= BuildCompScale
=
= Builds a compiled scaler object that will scale a 64 tall object to
= the given height (centered vertically on the screen)
=
= height should be even
=
========================
*/
#if 0
void xBuildCompScale(int height, byte *source, int x)
{
int i;
long fix,step;
int startpix,endpix,toppix;
unsigned char al;
step = height << 10;
toppix = (viewheight-height) >> 1;
fix = 0;
for (i = 0; i < 64; i++)
{
startpix = fix>>16;
fix += step;
endpix = fix>>16;
startpix+=toppix;
endpix+=toppix;
if (startpix == endpix || endpix < 0 || startpix >= viewheight)
continue;
al = source[i];
for (;startpix<endpix;startpix++)
{
if (startpix >= viewheight)
break; /* off the bottom of the view area */
if (startpix < 0)
continue; /* not into the view area */
VL_Plot(x+xoffset, startpix+yoffset, al);
}
}
}
#endif
/* TODO: this accesses gfxbuf directly! */ /* TODO: this accesses gfxbuf directly! */
static void ScaledDraw(byte *gfx, int scale, byte *vid, unsigned long tfrac, unsigned long tint, unsigned long delta) static void ScaledDraw(byte *gfx, int scale, byte *vid, unsigned long tfrac, unsigned long tint, unsigned long delta)
{ {
......
...@@ -649,7 +649,7 @@ void ShowArticle(char *article) ...@@ -649,7 +649,7 @@ void ShowArticle(char *article)
break; break;
} }
if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers")) if (IN_KeyDown(sc_Tab) && IN_KeyDown(sc_P) && MS_CheckParm("goobers"))
PicturePause(); PicturePause();
} while (LastScan != sc_Escape); } while (LastScan != sc_Escape);
......
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