Commit d331fdbc authored by Steven Fuller's avatar Steven Fuller

id_ca.c: more endian fixes. only one more PACKED struct to go (other than

adlib stuff).

id_vh.c, wl_menu.c: moved the font stuff from wl_menu.c's Message into
id_vh.c

wl_play.c, foreign.h: moved some text strings to foreign.h

rest: formatting cleanups
parent 3dadef2b
#define NUMSOUNDS 81 #define NUMSOUNDS 81
#define NUMSNDCHUNKS 267 #define NUMSNDCHUNKS 267
// /* Sound names & indexes */
// Sound names & indexes
//
typedef enum { typedef enum {
HITWALLSND, // 0 HITWALLSND, // 0
MISSILEHITSND, // 1 MISSILEHITSND, // 1
...@@ -89,16 +87,12 @@ typedef enum { ...@@ -89,16 +87,12 @@ typedef enum {
LASTSOUND LASTSOUND
} soundnames; } soundnames;
// /* Base offsets */
// Base offsets
//
#define STARTPCSOUNDS 0 #define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81 #define STARTADLIBSOUNDS 81
#define STARTMUSIC 243 #define STARTMUSIC 243
// /* Music names & indexes */
// Music names & indexes
//
typedef enum { typedef enum {
XFUNKIE_MUS, // 0 XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1 DUNGEON_MUS, // 1
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
" Overwrite?" " Overwrite?"
#define ENDGAMESTR "Are you sure you want\n"\ #define ENDGAMESTR "Are you sure you want\n"\
"to end the game you\n"\ "to end the game you\n"\
"are playing? (Y or N):" "are playing? (Y or N):"
#define STR_NG "New Game" #define STR_NG "New Game"
#define STR_SD "Sound" #define STR_SD "Sound"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#define STR_CALIB "Calibrate" #define STR_CALIB "Calibrate"
#define STR_JOYST "Joystick" #define STR_JOYST "Joystick"
#define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n" #define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n"
#define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n" #define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n"
#define STR_ESCEXIT "ESC to exit" #define STR_ESCEXIT "ESC to exit"
#define STR_NONE "None" #define STR_NONE "None"
...@@ -78,26 +78,34 @@ ...@@ -78,26 +78,34 @@
#define STR_TOTALTIME "total time" #define STR_TOTALTIME "total time"
#define STR_RATKILL "kill %" #define STR_RATKILL "kill %"
#define STR_RATSECRET "secret %" #define STR_RATSECRET "secret %"
#define STR_RATTREASURE "treasure %" #define STR_RATTREASURE "treasure %"
#define STR_BONUS "bonus" #define STR_BONUS "bonus"
#define STR_TIME "time" #define STR_TIME "time"
#define STR_PAR " par" #define STR_PAR " par"
#define STR_RAT2KILL "kill ratio %" #define STR_RAT2KILL "kill ratio %"
#define STR_RAT2SECRET "secret ratio %" #define STR_RAT2SECRET "secret ratio %"
#define STR_RAT2TREASURE "treasure ratio %" #define STR_RAT2TREASURE "treasure ratio %"
#define STR_DEFEATED "defeated!" #define STR_DEFEATED "defeated!"
#define STR_CHEATER1 "You now have 100% Health," #define STR_CHEATER "You now have 100% Health,\n"\
#define STR_CHEATER2 "99 Ammo and both Keys!" "99 Ammo and both Keys!\n\n"\
#define STR_CHEATER3 "Note that you have basically" "Note that you have basically\n"\
#define STR_CHEATER4 "eliminated your chances of" "eliminated your chances of\n"\
#define STR_CHEATER5 "getting a high score!" "getting a high score!"
#define STR_KEEN "Commander Keen is also\n"\
"available from Apogee, but\n"\
"then, you already know\n"\
"that - right, Cheatmeister?!"
#define STR_DEBUG "Debugging keys are\n"\
"now available!"
#define STR_NOSPACE1 "There is not enough space" #define STR_NOSPACE1 "There is not enough space"
#define STR_NOSPACE2 "on your disk to Save Game!" #define STR_NOSPACE2 "on your disk to Save Game!"
...@@ -119,10 +127,10 @@ ...@@ -119,10 +127,10 @@
#define ENDSTR8 "I'm thinkin' that\nyou might wanna press N\nto play more. You do it." #define ENDSTR8 "I'm thinkin' that\nyou might wanna press N\nto play more. You do it."
#define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress Y." #define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress Y."
#define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz." #define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz."
#define STR_ENDGAME2 "You have served your country well." #define STR_ENDGAME2 "You have served your country well."
#define STR_ENDGAME3 "With the spear gone, the Allies will finally" #define STR_ENDGAME3 "With the spear gone, the Allies will finally"
#define STR_ENDGAME4 "by able to destroy Hitler..." #define STR_ENDGAME4 "by able to destroy Hitler..."
#else #else
......
#include "wl_def.h" #include "wl_def.h"
#define PACKED __attribute__((packed))
typedef struct pcx_header_type typedef struct pcx_header_type
{ {
char manufacturer; char manufacturer;
......
This diff is collapsed.
...@@ -61,8 +61,8 @@ void MM_SortMem(); ...@@ -61,8 +61,8 @@ void MM_SortMem();
#define PMPageSize 4096 #define PMPageSize 4096
typedef struct { typedef struct {
longword offset; // Offset of chunk into file int offset; /* Offset of chunk into file */
int length; // Length of the chunk int length; /* Length of the chunk */
memptr addr; memptr addr;
} PageListStruct; } PageListStruct;
......
...@@ -21,9 +21,6 @@ typedef bool boolean; ...@@ -21,9 +21,6 @@ typedef bool boolean;
#define true TRUE #define true TRUE
#endif #endif
#define PACKED
#pragma pack(1)
#define ssize_t SSIZE_T #define ssize_t SSIZE_T
#else #else
...@@ -34,8 +31,6 @@ typedef bool boolean; ...@@ -34,8 +31,6 @@ typedef bool boolean;
#include <values.h> #include <values.h>
#include <glob.h> #include <glob.h>
#define PACKED __attribute__((packed))
#ifdef __cplusplus #ifdef __cplusplus
typedef bool boolean; typedef bool boolean;
#else #else
...@@ -88,10 +83,10 @@ typedef enum { false, true } boolean; ...@@ -88,10 +83,10 @@ typedef enum { false, true } boolean;
/* ---------------- */ /* ---------------- */
typedef unsigned char byte; typedef uint8_t byte;
typedef unsigned short int word; typedef uint16_t word;
typedef unsigned int longword; typedef uint32_t longword;
typedef unsigned long dword; typedef uint32_t dword;
typedef long fixed; typedef long fixed;
......
...@@ -117,10 +117,9 @@ void US_PrintUnsigned(longword n) ...@@ -117,10 +117,9 @@ void US_PrintUnsigned(longword n)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void USL_PrintInCenter(char *s, Rect r) void USL_PrintInCenter(char *s, Rect r)
{ {
word w,h, word w, h, rw, rh;
rw,rh;
USL_MeasureString(s,&w,&h); USL_MeasureString(s, &w, &h);
rw = r.lr.x - r.ul.x; rw = r.lr.x - r.ul.x;
rh = r.lr.y - r.ul.y; rh = r.lr.y - r.ul.y;
...@@ -136,7 +135,7 @@ void USL_PrintInCenter(char *s, Rect r) ...@@ -136,7 +135,7 @@ void USL_PrintInCenter(char *s, Rect r)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_PrintCentered(char *s) void US_PrintCentered(char *s)
{ {
Rect r; Rect r;
r.ul.x = WindowX; r.ul.x = WindowX;
r.ul.y = WindowY; r.ul.y = WindowY;
...@@ -154,9 +153,9 @@ void US_PrintCentered(char *s) ...@@ -154,9 +153,9 @@ void US_PrintCentered(char *s)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_CPrintLine(char *s) void US_CPrintLine(char *s)
{ {
word w,h; word w, h;
USL_MeasureString(s,&w,&h); USL_MeasureString(s, &w, &h);
if (w > WindowW) if (w > WindowW)
Quit("US_CPrintLine() - String exceeds width"); Quit("US_CPrintLine() - String exceeds width");
......
#include "wl_def.h" #include "wl_def.h"
pictabletype *pictable; pictabletype pictable[NUMPICS];
int px, py; int px, py;
byte fontcolor, backcolor; byte fontcolor, backcolor;
...@@ -327,10 +327,26 @@ void VW_DrawPropString(char *string) ...@@ -327,10 +327,26 @@ void VW_DrawPropString(char *string)
void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font) void VWL_MeasureString(char *string, word *width, word *height, fontstruct *font)
{ {
/* proportional width */ int w, mw;
w = 0;
mw = 0;
*height = font->height; *height = font->height;
for (*width = 0; *string; string++) for (;*string; string++) {
*width += font->width[*((byte *)string)]; if (*string == '\n') {
if (mw < w)
mw = w;
w = 0;
*height += font->height;
} else {
w += font->width[*((byte *)string)];
}
}
if (mw < w)
mw = w;
*width = mw;
} }
void VW_MeasurePropString(char *string, word *width, word *height) void VW_MeasurePropString(char *string, word *width, word *height)
......
...@@ -8,19 +8,19 @@ ...@@ -8,19 +8,19 @@
typedef struct typedef struct
{ {
word width, height; int width, height;
} PACKED pictabletype; } pictabletype;
typedef struct typedef struct
{ {
word height; word height;
word location[256]; word location[256];
char width[256]; byte width[256];
} PACKED fontstruct; } __attribute__((packed)) fontstruct;
/* ======================================================================== */ /* ======================================================================== */
extern pictabletype *pictable; extern pictabletype pictable[NUMPICS];
extern byte fontcolor; extern byte fontcolor;
extern int fontnumber; extern int fontnumber;
......
...@@ -199,7 +199,7 @@ void DisplayTextSplash(byte *text, int l) ...@@ -199,7 +199,7 @@ void DisplayTextSplash(byte *text, int l)
/* ** */ /* ** */
static int16_t SwapInt16L(int16_t i) uint16_t SwapInt16L(uint16_t i)
{ {
#if __BYTE_ORDER == __BIG_ENDIAN #if __BYTE_ORDER == __BIG_ENDIAN
return ((uint16_t)i >> 8) | ((uint16_t)i << 8); return ((uint16_t)i >> 8) | ((uint16_t)i << 8);
...@@ -208,7 +208,7 @@ static int16_t SwapInt16L(int16_t i) ...@@ -208,7 +208,7 @@ static int16_t SwapInt16L(int16_t i)
#endif #endif
} }
static int32_t SwapInt32L(int32_t i) uint32_t SwapInt32L(uint32_t i)
{ {
#if __BYTE_ORDER == __BIG_ENDIAN #if __BYTE_ORDER == __BIG_ENDIAN
return ((uint32_t)(i & 0xFF000000) >> 24) | return ((uint32_t)(i & 0xFF000000) >> 24) |
......
...@@ -24,6 +24,9 @@ char *ultoa(unsigned long value, char *string, int radix); ...@@ -24,6 +24,9 @@ char *ultoa(unsigned long value, char *string, int radix);
#endif /* DOSISM */ #endif /* DOSISM */
uint16_t SwapInt16L(uint16_t i);
uint32_t SwapInt32L(uint32_t i);
extern int OpenWrite(char *fn); extern int OpenWrite(char *fn);
extern int OpenWriteAppend(char *fn); extern int OpenWriteAppend(char *fn);
extern void CloseWrite(int fp); extern void CloseWrite(int fp);
......
#ifndef __SD_COMM_H__ #ifndef __SD_COMM_H__
#define __SD_COMM_H__ #define __SD_COMM_H__
#define PACKED __attribute__((packed))
#define TickBase 70 // 70Hz per tick #define TickBase 70 // 70Hz per tick
typedef enum { typedef enum {
......
...@@ -229,5 +229,7 @@ int DebugKeys() ...@@ -229,5 +229,7 @@ int DebugKeys()
return 1; return 1;
} }
DrawPlayBorder();
return 0; return 0;
} }
...@@ -563,11 +563,9 @@ void DrawPlanes() ...@@ -563,11 +563,9 @@ void DrawPlanes()
int x; int x;
if ((viewheight>>1) != halfheight) if ((viewheight>>1) != halfheight)
SetPlaneViewSize(); // screen size has changed SetPlaneViewSize(); /* screen size has changed */
// /* loop over all columns */
// loop over all columns
//
lastheight = halfheight; lastheight = halfheight;
for (x = 0; x < viewwidth; x++) for (x = 0; x < viewwidth; x++)
...@@ -636,21 +634,18 @@ static void ClearScreen() ...@@ -636,21 +634,18 @@ static void ClearScreen()
*/ */
#ifndef DRAWCEIL #ifndef DRAWCEIL
//#define DRAWCEIL /* #define DRAWCEIL */
#endif #endif
void ThreeDRefresh() void ThreeDRefresh()
{ {
// /* clear out the traced array */
// clear out the traced array
//
memset(spotvis, 0, sizeof(spotvis)); memset(spotvis, 0, sizeof(spotvis));
// /* follow the walls from there to the right, drawing as we go */
// follow the walls from there to the right, drawwing as we go
// /* DrawPlayBorder(); */
DrawPlayBorder();
#ifndef DRAWCEIL #ifndef DRAWCEIL
ClearScreen(); ClearScreen();
#endif #endif
...@@ -659,21 +654,18 @@ void ThreeDRefresh() ...@@ -659,21 +654,18 @@ void ThreeDRefresh()
#ifdef DRAWCEIL #ifdef DRAWCEIL
DrawPlanes(); /* silly floor/ceiling drawing */ DrawPlanes(); /* silly floor/ceiling drawing */
#endif #endif
//
// draw all the scaled images /* draw all the scaled images */
//
DrawScaleds(); /* draw scaled stuff */ DrawScaleds(); /* draw scaled stuff */
DrawPlayerWeapon(); /* draw player's hands */ DrawPlayerWeapon(); /* draw player's hands */
// /* show screen and time last cycle */
// show screen and time last cycle
//
if (fizzlein) if (fizzlein)
{ {
FizzleFade(xoffset, yoffset, viewwidth, viewheight, 20, false); FizzleFade(xoffset, yoffset, viewwidth, viewheight, 20, false);
fizzlein = false; fizzlein = false;
lasttimecount = 0; /* don't make a big tic count */ lasttimecount = 0; /* don't make a big tic count */
set_TimeCount(0); set_TimeCount(0);
} }
......
...@@ -441,7 +441,7 @@ void ScanInfoPlane() ...@@ -441,7 +441,7 @@ void ScanInfoPlane()
} }
} }
//========================================================================== /* ======================================================================== */
/* /*
================== ==================
...@@ -471,22 +471,17 @@ void SetupGameLevel() ...@@ -471,22 +471,17 @@ void SetupGameLevel()
else else
US_InitRndT(true); US_InitRndT(true);
// /* load the level */
// load the level
//
CA_CacheMap(gamestate.mapon+10*gamestate.episode); CA_CacheMap(gamestate.mapon+10*gamestate.episode);
mapon -= gamestate.episode*10; mapon -= gamestate.episode*10;
if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64)) if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64))
Quit("Map not 64*64!"); Quit("Map not 64*64!");
//
// copy the wall data to a data segment array
//
memset(tilemap, 0, sizeof(tilemap)); memset(tilemap, 0, sizeof(tilemap));
memset(actorat, 0, sizeof(actorat)); memset(actorat, 0, sizeof(actorat));
/* copy the wall data to a data segment array */
map = mapsegs[0]; map = mapsegs[0];
for (y = 0; y < mapheight; y++) for (y = 0; y < mapheight; y++)
for (x = 0; x < mapwidth; x++) { for (x = 0; x < mapwidth; x++) {
...@@ -499,14 +494,12 @@ void SetupGameLevel() ...@@ -499,14 +494,12 @@ void SetupGameLevel()
actorat[x][y] = 0; actorat[x][y] = 0;
} }
} }
//
// spawn doors
//
InitActorList(); /* start spawning things with a clean slate */ InitActorList(); /* start spawning things with a clean slate */
InitDoorList(); InitDoorList();
InitStaticList(); InitStaticList();
/* spawn doors */
map = mapsegs[0]; map = mapsegs[0];
for (y=0;y<mapheight;y++) for (y=0;y<mapheight;y++)
for (x=0;x<mapwidth;x++) for (x=0;x<mapwidth;x++)
...@@ -514,8 +507,8 @@ void SetupGameLevel() ...@@ -514,8 +507,8 @@ void SetupGameLevel()
tile = *map++; tile = *map++;
if (tile >= 90 && tile <= 101) if (tile >= 90 && tile <= 101)
{ {
// door /* door */
switch (tile) switch(tile)
{ {
case 90: case 90:
case 92: case 92:
...@@ -523,7 +516,7 @@ void SetupGameLevel() ...@@ -523,7 +516,7 @@ void SetupGameLevel()
case 96: case 96:
case 98: case 98:
case 100: case 100:
SpawnDoor (x,y,1,(tile-90)/2); SpawnDoor(x, y, 1, (tile-90)/2);
break; break;
case 91: case 91:
case 93: case 93:
...@@ -531,20 +524,16 @@ void SetupGameLevel() ...@@ -531,20 +524,16 @@ void SetupGameLevel()
case 97: case 97:
case 99: case 99:
case 101: case 101:
SpawnDoor (x,y,0,(tile-91)/2); SpawnDoor(x, y, 0,(tile-91)/2);
break; break;
} }
} }
} }
// /* spawn actors */
// spawn actors
//
ScanInfoPlane(); ScanInfoPlane();
// /* take out the ambush markers */
// take out the ambush markers
//
map = mapsegs[0]; map = mapsegs[0];
for (y=0;y<mapheight;y++) for (y=0;y<mapheight;y++)
for (x=0;x<mapwidth;x++) for (x=0;x<mapwidth;x++)
...@@ -572,9 +561,7 @@ void SetupGameLevel() ...@@ -572,9 +561,7 @@ void SetupGameLevel()
CA_LoadAllSounds(); CA_LoadAllSounds();
} }
/* ======================================================================== */
//==========================================================================
/* /*
=================== ===================
...@@ -667,7 +654,7 @@ void DrawPlayScreen() ...@@ -667,7 +654,7 @@ void DrawPlayScreen()
DrawStatusBar(); DrawStatusBar();
} }
//========================================================================== /* ======================================================================= */
/* /*
================== ==================
...@@ -820,10 +807,10 @@ void PlayDemo(int demonumber) ...@@ -820,10 +807,10 @@ void PlayDemo(int demonumber)
CA_CacheGrChunk(dems[demonumber]); CA_CacheGrChunk(dems[demonumber]);
demoptr = grsegs[dems[demonumber]]; demoptr = grsegs[dems[demonumber]];
NewGame (1,0); NewGame(1, 0);
gamestate.mapon = *demoptr++; gamestate.mapon = *demoptr++;
gamestate.difficulty = gd_hard; gamestate.difficulty = gd_hard;
length = demoptr[0] | (demoptr[1] << 8); // *((word *)demoptr)++; length = demoptr[0] | (demoptr[1] << 8);
demoptr += 3; demoptr += 3;
lastdemoptr = demoptr-4+length; lastdemoptr = demoptr-4+length;
...@@ -838,7 +825,7 @@ void PlayDemo(int demonumber) ...@@ -838,7 +825,7 @@ void PlayDemo(int demonumber)
startgame = false; startgame = false;
demoplayback = true; demoplayback = true;
SetupGameLevel (); SetupGameLevel();
StartMusic(); StartMusic();
fizzlein = true; fizzlein = true;
...@@ -869,7 +856,7 @@ int PlayDemoFromFile(char *demoname) ...@@ -869,7 +856,7 @@ int PlayDemoFromFile(char *demoname)
NewGame(1,0); NewGame(1,0);
gamestate.mapon = *demoptr++; gamestate.mapon = *demoptr++;
gamestate.difficulty = gd_hard; gamestate.difficulty = gd_hard;
length = demoptr[0] | (demoptr[1] << 8); // *((word *)demoptr)++; length = demoptr[0] | (demoptr[1] << 8);
demoptr += 3; demoptr += 3;
lastdemoptr = demoptr-4+length; lastdemoptr = demoptr-4+length;
......
...@@ -554,11 +554,11 @@ int CP_CheckQuick(unsigned scancode) ...@@ -554,11 +554,11 @@ int CP_CheckQuick(unsigned scancode)
CA_CacheGrChunk(C_SAVEGAMEPIC); CA_CacheGrChunk(C_SAVEGAMEPIC);
CA_CacheGrChunk(C_MOUSELBACKPIC); CA_CacheGrChunk(C_MOUSELBACKPIC);
#else #else
CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END); CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
CA_CacheGrChunk(C_CURSOR1PIC); CA_CacheGrChunk(C_CURSOR1PIC);
#endif #endif
VW_FadeOut (); VW_FadeOut();
StartCPMusic(MENUSONG); StartCPMusic(MENUSONG);
pickquick=CP_SaveGame(0); pickquick=CP_SaveGame(0);
...@@ -577,8 +577,6 @@ int CP_CheckQuick(unsigned scancode) ...@@ -577,8 +577,6 @@ int CP_CheckQuick(unsigned scancode)
playstate = ex_abort; playstate = ex_abort;
lasttimecount = get_TimeCount(); lasttimecount = get_TimeCount();
#ifndef SPEAR #ifndef SPEAR
CA_UnCacheGrChunk(C_CURSOR1PIC); CA_UnCacheGrChunk(C_CURSOR1PIC);
CA_UnCacheGrChunk(C_CURSOR2PIC); CA_UnCacheGrChunk(C_CURSOR2PIC);
...@@ -592,15 +590,12 @@ int CP_CheckQuick(unsigned scancode) ...@@ -592,15 +590,12 @@ int CP_CheckQuick(unsigned scancode)
} }
return 1; return 1;
// /* QUICKLOAD */
// QUICKLOAD
//
case sc_F9: case sc_F9:
if (SaveGamesAvail[LSItems.curpos] && pickquick) if (SaveGamesAvail[LSItems.curpos] && pickquick)
{ {
char string[100]=STR_LGC; char string[100]=STR_LGC;
CA_CacheGrChunk(STARTFONT+1); CA_CacheGrChunk(STARTFONT+1);
fontnumber = 1; fontnumber = 1;
...@@ -2476,7 +2471,7 @@ void DrawChangeView(int view) ...@@ -2476,7 +2471,7 @@ void DrawChangeView(int view)
// QUIT THIS INFERNAL GAME! // QUIT THIS INFERNAL GAME!
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CP_Quit(void) void CP_Quit()
{ {
if (Confirm(endStrings[(US_RndT()&0x7)+(US_RndT()&1)])) if (Confirm(endStrings[(US_RndT()&0x7)+(US_RndT()&1)]))
{ {
...@@ -3109,7 +3104,6 @@ int Confirm(char *string) ...@@ -3109,7 +3104,6 @@ int Confirm(char *string)
{ {
int xit=0,x,y,tick=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND}; int xit=0,x,y,tick=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
Message(string); Message(string);
IN_ClearKeysDown(); IN_ClearKeysDown();
...@@ -3164,28 +3158,14 @@ int Confirm(char *string) ...@@ -3164,28 +3158,14 @@ int Confirm(char *string)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void Message(char *string) void Message(char *string)
{ {
int h=0,w=0,mw=0,i; word h=0, mw=0;
fontstruct *font;
CA_CacheGrChunk(STARTFONT+1);
CA_CacheGrChunk (STARTFONT+1);
fontnumber=1; fontnumber=1;
font= (fontstruct *)grsegs[STARTFONT+fontnumber];
h=font->height;
for (i=0;i<strlen(string);i++)
if (string[i]=='\n')
{
if (w>mw)
mw=w;
w=0;
h+=font->height;
}
else
w+=font->width[(int)string[i]];
if (w+10>mw)
mw=w+10;
VW_MeasurePropString(string, &mw, &h);
mw += 4;
PrintY=(WindowH/2)-h/2; PrintY=(WindowH/2)-h/2;
PrintX=WindowX=160-mw/2; PrintX=WindowX=160-mw/2;
......
...@@ -558,21 +558,17 @@ void CheckKeys() ...@@ -558,21 +558,17 @@ void CheckKeys()
DrawAmmo(); DrawAmmo();
DrawScore(); DrawScore();
ClearMemory (); ClearMemory();
CA_CacheGrChunk (STARTFONT+1); CA_CacheGrChunk(STARTFONT+1);
ClearSplitVWB (); ClearSplitVWB();
Message(STR_CHEATER1"\n" Message(STR_CHEATER);
STR_CHEATER2"\n\n"
STR_CHEATER3"\n"
STR_CHEATER4"\n"
STR_CHEATER5);
CA_UnCacheGrChunk(STARTFONT+1); CA_UnCacheGrChunk(STARTFONT+1);
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
DrawPlayBorder (); DrawPlayBorder();
} }
// //
...@@ -581,15 +577,16 @@ void CheckKeys() ...@@ -581,15 +577,16 @@ void CheckKeys()
if (IN_KeyDown(sc_BackSpace) && IN_KeyDown(sc_LShift) && if (IN_KeyDown(sc_BackSpace) && IN_KeyDown(sc_LShift) &&
IN_KeyDown(sc_Alt) && MS_CheckParm("debugmode")) { IN_KeyDown(sc_Alt) && MS_CheckParm("debugmode")) {
ClearMemory(); ClearMemory();
CA_CacheGrChunk (STARTFONT+1); CA_CacheGrChunk(STARTFONT+1);
ClearSplitVWB (); ClearSplitVWB();
Message("Debugging keys are\nnow available!"); Message(STR_DEBUG);
CA_UnCacheGrChunk(STARTFONT+1); CA_UnCacheGrChunk(STARTFONT+1);
IN_ClearKeysDown(); IN_ClearKeysDown();
IN_Ack(); IN_Ack();
DrawPlayBorderSides (); DrawPlayBorderSides();
DebugOk=1; DebugOk=1;
} }
...@@ -601,10 +598,7 @@ void CheckKeys() ...@@ -601,10 +598,7 @@ void CheckKeys()
CA_CacheGrChunk(STARTFONT+1); CA_CacheGrChunk(STARTFONT+1);
ClearSplitVWB(); ClearSplitVWB();
Message("Commander Keen is also\n" Message(STR_KEEN);
"available from Apogee, but\n"
"then, you already know\n"
"that - right, Cheatmeister?!");
CA_UnCacheGrChunk(STARTFONT+1); CA_UnCacheGrChunk(STARTFONT+1);
IN_ClearKeysDown(); IN_ClearKeysDown();
......
...@@ -364,10 +364,8 @@ void HandleWord() ...@@ -364,10 +364,8 @@ void HandleWord()
} }
words[wordindex] = 0; // stick a null at end for C words[wordindex] = 0; // stick a null at end for C
// /* see if it fits on this line */
// see if it fits on this line VW_MeasurePropString(words, &wwidth, &wheight);
//
VW_MeasurePropString (words, &wwidth, &wheight);
while (px+wwidth > rightmargin[rowon]) while (px+wwidth > rightmargin[rowon])
{ {
...@@ -380,7 +378,7 @@ void HandleWord() ...@@ -380,7 +378,7 @@ void HandleWord()
// print it // print it
// //
newpos = px+wwidth; newpos = px+wwidth;
VW_DrawPropString (words); VW_DrawPropString(words);
px = newpos; px = newpos;
// //
......
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