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;
......
...@@ -14,7 +14,7 @@ typedef struct ...@@ -14,7 +14,7 @@ typedef struct
============================================================================= =============================================================================
*/ */
unsigned int RLEWtag; word RLEWtag;
int mapon; int mapon;
word *mapsegs[MAPPLANES]; word *mapsegs[MAPPLANES];
...@@ -62,47 +62,25 @@ static void CA_CannotOpen(char *string) ...@@ -62,47 +62,25 @@ static void CA_CannotOpen(char *string)
/* /*
========================== ==========================
= =
= CA_FarRead = CA_WriteFile
= =
= Read from a file to a pointer = Writes a file from a memory buffer
= =
========================== ==========================
*/ */
boolean CA_FarRead(int handle, byte *dest, long length) boolean CA_WriteFile(char *filename, void *ptr, long length)
{ {
ssize_t l; ssize_t l;
int handle;
l = read(handle, dest, length);
if (l == -1) {
perror("CA_FarRead");
return false;
} else if (l == 0) {
fprintf(stderr, "CA_FarRead hit EOF?\n");
return false;
} else if (l != length) {
fprintf(stderr, "CA_FarRead only read %d out of %ld\n", l, length);
return false;
}
return true;
}
/* handle = open(filename, O_CREAT | O_BINARY | O_WRONLY,
========================== S_IREAD | S_IWRITE | S_IFREG);
=
= CA_FarWrite
=
= Write from a file to a pointer
=
==========================
*/
boolean CA_FarWrite(int handle, byte *source, long length) if (handle == -1)
{ return false;
ssize_t l;
l = write(handle, ptr, length);
l = write(handle, source, length);
if (l == -1) { if (l == -1) {
perror("CA_FarWrite"); perror("CA_FarWrite");
return false; return false;
...@@ -113,34 +91,7 @@ boolean CA_FarWrite(int handle, byte *source, long length) ...@@ -113,34 +91,7 @@ boolean CA_FarWrite(int handle, byte *source, long length)
fprintf(stderr, "CA_FarWrite only wrote %d out of %ld\n", l, length); fprintf(stderr, "CA_FarWrite only wrote %d out of %ld\n", l, length);
return false; return false;
} }
return true;
}
/*
==========================
=
= CA_WriteFile
=
= Writes a file from a memory buffer
=
==========================
*/
boolean CA_WriteFile(char *filename, void *ptr, long length)
{
int handle;
handle = open(filename, O_CREAT | O_BINARY | O_WRONLY,
S_IREAD | S_IWRITE | S_IFREG);
if (handle == -1)
return false;
if (!CA_FarWrite(handle, ptr, length)) {
close(handle);
return false;
}
close(handle); close(handle);
return true; return true;
} }
...@@ -158,18 +109,28 @@ boolean CA_WriteFile(char *filename, void *ptr, long length) ...@@ -158,18 +109,28 @@ boolean CA_WriteFile(char *filename, void *ptr, long length)
boolean CA_LoadFile(char *filename, memptr *ptr) boolean CA_LoadFile(char *filename, memptr *ptr)
{ {
int handle; int handle;
ssize_t l;
long size; long size;
if ((handle = open(filename, O_RDONLY | O_BINARY)) == -1) if ((handle = open(filename, O_RDONLY | O_BINARY)) == -1)
return false; return false;
size = filelength(handle); size = filelength(handle);
MM_GetPtr (ptr,size); MM_GetPtr(ptr, size);
if (!CA_FarRead(handle,*ptr,size))
{ l = read(handle, ptr, size);
close (handle);
if (l == -1) {
perror("CA_FarRead");
return false;
} else if (l == 0) {
fprintf(stderr, "CA_FarRead hit EOF?\n");
return false;
} else if (l != size) {
fprintf(stderr, "CA_FarRead only read %d out of %ld\n", l, size);
return false; return false;
} }
close(handle); close(handle);
return true; return true;
} }
...@@ -233,7 +194,7 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable) ...@@ -233,7 +194,7 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
#define NEARTAG 0xa7 #define NEARTAG 0xa7
#define FARTAG 0xa8 #define FARTAG 0xa8
void CAL_CarmackExpand(word *source, word *dest, word length) void CAL_CarmackExpand(byte *source, word *dest, word length)
{ {
unsigned int offset; unsigned int offset;
word *copyptr, *outptr; word *copyptr, *outptr;
...@@ -241,7 +202,7 @@ void CAL_CarmackExpand(word *source, word *dest, word length) ...@@ -241,7 +202,7 @@ void CAL_CarmackExpand(word *source, word *dest, word length)
length /= 2; length /= 2;
inptr = (byte *)source; inptr = source;
outptr = dest; outptr = dest;
while (length) { while (length) {
...@@ -308,10 +269,10 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag) ...@@ -308,10 +269,10 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag)
if (value != rlewtag) if (value != rlewtag)
/* uncompressed */ /* uncompressed */
*dest++=value; *dest++ = value;
else { else {
/* compressed string */ /* compressed string */
count = *source++; count = SwapInt16L(*source); source++;
value = *source++; value = *source++;
for (i = 1; i <= count; i++) for (i = 1; i <= count; i++)
*dest++ = value; *dest++ = value;
...@@ -344,10 +305,7 @@ static void CAL_SetupGrFile() ...@@ -344,10 +305,7 @@ static void CAL_SetupGrFile()
byte *grtemp; byte *grtemp;
int i; int i;
// /* load vgadict.ext (huffman dictionary for graphics files) */
// load vgadict.ext (huffman dictionary for graphics files)
//
strcpy(fname, gdictname); strcpy(fname, gdictname);
strcat(fname, extension); strcat(fname, extension);
...@@ -362,9 +320,7 @@ static void CAL_SetupGrFile() ...@@ -362,9 +320,7 @@ static void CAL_SetupGrFile()
CloseRead(handle); CloseRead(handle);
// /* load the data offsets from vgahead.ext */
// load the data offsets from vgahead.ext
//
MM_GetPtr((memptr)&grstarts, (NUMCHUNKS+1)*4); MM_GetPtr((memptr)&grstarts, (NUMCHUNKS+1)*4);
MM_GetPtr((memptr)&grtemp, (NUMCHUNKS+1)*3); MM_GetPtr((memptr)&grtemp, (NUMCHUNKS+1)*3);
...@@ -384,9 +340,7 @@ static void CAL_SetupGrFile() ...@@ -384,9 +340,7 @@ static void CAL_SetupGrFile()
CloseRead(handle); CloseRead(handle);
// /* Open the graphics file, leaving it open until the game is finished */
// Open the graphics file, leaving it open until the game is finished
//
strcpy(fname, gfilename); strcpy(fname, gfilename);
strcat(fname, extension); strcat(fname, extension);
...@@ -394,10 +348,7 @@ static void CAL_SetupGrFile() ...@@ -394,10 +348,7 @@ static void CAL_SetupGrFile()
if (grhandle == -1) if (grhandle == -1)
CA_CannotOpen(fname); CA_CannotOpen(fname);
// /* load the pic headers into pictable */
// load the pic headers into pictable
//
MM_GetPtr((memptr)&pictable, NUMPICS*sizeof(pictabletype));
chunkcomplen = grstarts[STRUCTPIC+1] - grstarts[STRUCTPIC]; chunkcomplen = grstarts[STRUCTPIC+1] - grstarts[STRUCTPIC];
ReadSeek(grhandle, grstarts[STRUCTPIC], SEEK_SET); ReadSeek(grhandle, grstarts[STRUCTPIC], SEEK_SET);
...@@ -405,11 +356,20 @@ static void CAL_SetupGrFile() ...@@ -405,11 +356,20 @@ static void CAL_SetupGrFile()
ReadBytes(grhandle, compseg, chunkcomplen); ReadBytes(grhandle, compseg, chunkcomplen);
CAL_HuffExpand((byte *)compseg+4, (byte *)pictable, NUMPICS*sizeof(pictabletype), grhuffman); /* pictable is word width, height */
MM_GetPtr((memptr)&grtemp, NUMPICS*4);
CAL_HuffExpand((byte *)compseg+4, (byte *)grtemp, NUMPICS*4, grhuffman);
MM_FreePtr(&compseg); MM_FreePtr(&compseg);
for (i = 0; i < NUMPICS; i++) {
pictable[i].width = grtemp[i*4+0] | (grtemp[i*4+1] << 8);
pictable[i].height = grtemp[i*4+2] | (grtemp[i*4+3] << 8);
}
MM_FreePtr((memptr)&grtemp);
} }
//========================================================================== /* ======================================================================== */
/* /*
...@@ -434,7 +394,8 @@ static void CAL_SetupMapFile() ...@@ -434,7 +394,8 @@ static void CAL_SetupMapFile()
if (handle == -1) if (handle == -1)
CA_CannotOpen(fname); CA_CannotOpen(fname);
RLEWtag = ReadInt16(handle); /* RLEWtag = ReadInt16(handle); */
ReadBytes(handle, (byte *)&RLEWtag, 2); /* RLEWtag = word */
/* open the data file */ /* open the data file */
strcpy(fname, gmapsname); strcpy(fname, gmapsname);
...@@ -444,9 +405,7 @@ static void CAL_SetupMapFile() ...@@ -444,9 +405,7 @@ static void CAL_SetupMapFile()
if (maphandle == -1) if (maphandle == -1)
CA_CannotOpen(fname); CA_CannotOpen(fname);
// /* load all map header */
// load all map header
//
for (i = 0; i < NUMMAPS; i++) for (i = 0; i < NUMMAPS; i++)
{ {
pos = ReadInt32(handle); pos = ReadInt32(handle);
...@@ -469,14 +428,12 @@ static void CAL_SetupMapFile() ...@@ -469,14 +428,12 @@ static void CAL_SetupMapFile()
mapheaderseg[i]->planelength[2] = ReadInt16(maphandle); mapheaderseg[i]->planelength[2] = ReadInt16(maphandle);
mapheaderseg[i]->width = ReadInt16(maphandle); mapheaderseg[i]->width = ReadInt16(maphandle);
mapheaderseg[i]->height = ReadInt16(maphandle); mapheaderseg[i]->height = ReadInt16(maphandle);
ReadBytes(maphandle, (byte *)mapheaderseg[i]->name, 16); ReadBytes(maphandle, (byte *)mapheaderseg[i]->name, 16);
} }
CloseRead(handle); CloseRead(handle);
//
// allocate space for 2 64*64 planes /* allocate space for 2 64*64 planes */
//
for (i = 0;i < MAPPLANES; i++) { for (i = 0;i < MAPPLANES; i++) {
MM_GetPtr((memptr)&mapsegs[i], 64*64*2); MM_GetPtr((memptr)&mapsegs[i], 64*64*2);
MM_SetLock((memptr)&mapsegs[i], true); MM_SetLock((memptr)&mapsegs[i], true);
...@@ -565,7 +522,7 @@ void CA_Shutdown() ...@@ -565,7 +522,7 @@ void CA_Shutdown()
CloseRead(audiohandle); CloseRead(audiohandle);
} }
//=========================================================================== /* ======================================================================== */
/* /*
====================== ======================
...@@ -577,16 +534,11 @@ void CA_Shutdown() ...@@ -577,16 +534,11 @@ void CA_Shutdown()
void CA_CacheAudioChunk(int chunk) void CA_CacheAudioChunk(int chunk)
{ {
long pos, length; int pos, length;
if (audiosegs[chunk]) { if (audiosegs[chunk])
return; return;
}
//
// load the chunk into a buffer, either the miscbuffer if it fits, or allocate
// a larger buffer
//
pos = audiostarts[chunk]; pos = audiostarts[chunk];
length = audiostarts[chunk+1]-pos; length = audiostarts[chunk+1]-pos;
...@@ -624,8 +576,7 @@ void CA_LoadAllSounds() ...@@ -624,8 +576,7 @@ void CA_LoadAllSounds()
CA_CacheAudioChunk(start); CA_CacheAudioChunk(start);
} }
//=========================================================================== /* ======================================================================== */
/* /*
====================== ======================
...@@ -646,29 +597,23 @@ static void CAL_ExpandGrChunk(int chunk, byte *source) ...@@ -646,29 +597,23 @@ static void CAL_ExpandGrChunk(int chunk, byte *source)
if (chunk >= STARTTILE8 && chunk < STARTEXTERNS) if (chunk >= STARTTILE8 && chunk < STARTEXTERNS)
{ {
// /* expanded sizes of tile8 are implicit */
// expanded sizes of tile8 are implicit expanded = 8*8*NUMTILE8;
//
expanded = (8*8)*NUMTILE8;
width = 8; width = 8;
height = 8; height = 8;
tilecount = NUMTILE8; tilecount = NUMTILE8;
} else if (chunk >= STARTPICS && chunk < STARTTILE8) { } else if (chunk >= STARTPICS && chunk < STARTTILE8) {
width = pictable[chunk - STARTPICS].width; width = pictable[chunk - STARTPICS].width;
height = pictable[chunk - STARTPICS].height; height = pictable[chunk - STARTPICS].height;
expanded = *((long *)source); expanded = source[0]|(source[1]<<8)|(source[2]<<16)|(source[3]<<24);
source += 4; source += 4;
} else { } else {
// /* everything else has an explicit size longword */
// everything else has an explicit size longword expanded = source[0]|(source[1]<<8)|(source[2]<<16)|(source[3]<<24);
//
expanded = *((long *)source);
source += 4; source += 4;
} }
// /* allocate final space and decompress it */
// allocate final space and decompress it
//
MM_GetPtr((void *)&grsegs[chunk], expanded); MM_GetPtr((void *)&grsegs[chunk], expanded);
CAL_HuffExpand(source, grsegs[chunk], expanded, grhuffman); CAL_HuffExpand(source, grsegs[chunk], expanded, grhuffman);
if (width && height) { if (width && height) {
...@@ -695,7 +640,6 @@ void CA_CacheGrChunk(int chunk) ...@@ -695,7 +640,6 @@ void CA_CacheGrChunk(int chunk)
long pos, compressed; long pos, compressed;
byte *source; byte *source;
/* this is due to Quit() wanting to cache the error screen before this has been set up! */
if (grhandle == -1) if (grhandle == -1)
return; return;
...@@ -703,9 +647,7 @@ void CA_CacheGrChunk(int chunk) ...@@ -703,9 +647,7 @@ void CA_CacheGrChunk(int chunk)
return; return;
} }
// /* load the chunk into a buffer */
// load the chunk into a buffer
//
pos = grstarts[chunk]; pos = grstarts[chunk];
compressed = grstarts[chunk+1]-pos; compressed = grstarts[chunk+1]-pos;
...@@ -729,9 +671,9 @@ void CA_UnCacheGrChunk(int chunk) ...@@ -729,9 +671,9 @@ void CA_UnCacheGrChunk(int chunk)
MM_FreePtr((memptr)&grsegs[chunk]); MM_FreePtr((memptr)&grsegs[chunk]);
grsegs[chunk] = 0; grsegs[chunk] = NULL;
} }
/* ======================================================================== */ /* ======================================================================== */
/* /*
...@@ -744,48 +686,41 @@ void CA_UnCacheGrChunk(int chunk) ...@@ -744,48 +686,41 @@ void CA_UnCacheGrChunk(int chunk)
void CA_CacheMap(int mapnum) void CA_CacheMap(int mapnum)
{ {
long pos,compressed; long pos,compressed;
int plane; int plane;
memptr *dest,bigbufferseg; byte *source;
word size; memptr buffer2seg;
word *source; long expanded;
memptr buffer2seg; int i;
long expanded;
mapon = mapnum; mapon = mapnum;
// /* load the planes into the already allocated buffers */
// load the planes into the allready allocated buffers
//
size = 64*64*2;
for (plane = 0; plane < MAPPLANES; plane++) for (plane = 0; plane < MAPPLANES; plane++)
{ {
pos = mapheaderseg[mapnum]->planestart[plane]; pos = mapheaderseg[mapnum]->planestart[plane];
compressed = mapheaderseg[mapnum]->planelength[plane]; compressed = mapheaderseg[mapnum]->planelength[plane];
dest = (memptr)&mapsegs[plane]; ReadSeek(maphandle, pos, SEEK_SET);
lseek(maphandle,pos,SEEK_SET); MM_GetPtr((void *)&source, compressed);
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true); ReadBytes(maphandle, (byte *)source, compressed);
source = bigbufferseg;
expanded = source[0] | (source[1] << 8);
CA_FarRead(maphandle,(byte *)source,compressed);
/*
unhuffman, then unRLEW
The huffman'd chunk has a two byte expanded length first
The resulting RLEW chunk also does, even though it's not really
needed
*/
expanded = *source;
source++;
MM_GetPtr(&buffer2seg, expanded); MM_GetPtr(&buffer2seg, expanded);
CAL_CarmackExpand(source, (word *)buffer2seg,expanded);
CA_RLEWexpand(((word *)buffer2seg)+1,*dest,size, RLEWtag); CAL_CarmackExpand(source+2, (word *)buffer2seg, expanded);
MM_FreePtr((void *)&source);
expanded = 64*64*2;
CA_RLEWexpand(((word *)buffer2seg)+1, mapsegs[plane], expanded, RLEWtag);
MM_FreePtr(&buffer2seg); MM_FreePtr(&buffer2seg);
MM_FreePtr(&bigbufferseg); /* swap for big-endian */
for (i = 0; i < 64*64; i++)
mapsegs[plane][i] = SwapInt16L(mapsegs[plane][i]);
} }
} }
...@@ -838,9 +773,6 @@ int ChunksInFile, PMSpriteStart, PMSoundStart; ...@@ -838,9 +773,6 @@ int ChunksInFile, PMSpriteStart, PMSoundStart;
PageListStruct *PMPages; PageListStruct *PMPages;
//
// PML_ReadFromFile() - Reads some data in from the page file
//
static void PML_ReadFromFile(byte *buf, long offset, word length) static void PML_ReadFromFile(byte *buf, long offset, word length)
{ {
if (!buf) if (!buf)
...@@ -853,9 +785,6 @@ static void PML_ReadFromFile(byte *buf, long offset, word length) ...@@ -853,9 +785,6 @@ static void PML_ReadFromFile(byte *buf, long offset, word length)
Quit("PML_ReadFromFile: Read failed"); Quit("PML_ReadFromFile: Read failed");
} }
//
// PML_OpenPageFile() - Opens the page file and sets up the page info
//
static void PML_OpenPageFile() static void PML_OpenPageFile()
{ {
int i; int i;
...@@ -869,29 +798,26 @@ static void PML_OpenPageFile() ...@@ -869,29 +798,26 @@ static void PML_OpenPageFile()
if (PageFile == -1) if (PageFile == -1)
Quit("PML_OpenPageFile: Unable to open page file"); Quit("PML_OpenPageFile: Unable to open page file");
// Read in header variables /* Read in header variables */
ChunksInFile = ReadInt16(PageFile); ChunksInFile = ReadInt16(PageFile);
PMSpriteStart = ReadInt16(PageFile); PMSpriteStart = ReadInt16(PageFile);
PMSoundStart = ReadInt16(PageFile); PMSoundStart = ReadInt16(PageFile);
// Allocate and clear the page list /* Allocate and clear the page list */
MM_GetPtr((memptr)&PMPages, sizeof(PageListStruct) * ChunksInFile); MM_GetPtr((memptr)&PMPages, sizeof(PageListStruct) * ChunksInFile);
MM_SetLock((memptr)&PMPages, true); MM_SetLock((memptr)&PMPages, true);
memset(PMPages, 0, sizeof(PageListStruct) * ChunksInFile); memset(PMPages, 0, sizeof(PageListStruct) * ChunksInFile);
// Read in the chunk offsets /* Read in the chunk offsets */
for (i = 0, page = PMPages; i < ChunksInFile; i++, page++) for (i = 0, page = PMPages; i < ChunksInFile; i++, page++)
page->offset = ReadInt32(PageFile); page->offset = ReadInt32(PageFile);
// Read in the chunk lengths /* Read in the chunk lengths */
for (i = 0, page = PMPages; i < ChunksInFile; i++, page++) for (i = 0, page = PMPages; i < ChunksInFile; i++, page++)
page->length = ReadInt16(PageFile); page->length = ReadInt16(PageFile);
} }
//
// PML_ClosePageFile() - Closes the page file
//
static void PML_ClosePageFile() static void PML_ClosePageFile()
{ {
if (PageFile != -1) if (PageFile != -1)
...@@ -903,9 +829,6 @@ static void PML_ClosePageFile() ...@@ -903,9 +829,6 @@ static void PML_ClosePageFile()
} }
} }
//
// PM_GetPage() - Returns the address of the page, loading it if necessary
//
memptr PM_GetPage(int pagenum) memptr PM_GetPage(int pagenum)
{ {
PageListStruct *page; PageListStruct *page;
...@@ -921,11 +844,6 @@ memptr PM_GetPage(int pagenum) ...@@ -921,11 +844,6 @@ memptr PM_GetPage(int pagenum)
return page->addr; return page->addr;
} }
//
// PM_Preload() - Loads as many pages as possible into all types of memory.
// Calls the update function after each load, indicating the current
// page, and the total pages that need to be loaded (for thermometer).
//
void PM_Preload(boolean (*update)(int current, int total)) void PM_Preload(boolean (*update)(int current, int total))
{ {
int i; int i;
...@@ -935,9 +853,6 @@ void PM_Preload(boolean (*update)(int current, int total)) ...@@ -935,9 +853,6 @@ void PM_Preload(boolean (*update)(int current, int total))
update(50, 50); update(50, 50);
} }
//
// PM_Startup() - Start up the Page Mgr
//
void PM_Startup() void PM_Startup()
{ {
if (PMStarted) if (PMStarted)
...@@ -948,9 +863,6 @@ void PM_Startup() ...@@ -948,9 +863,6 @@ void PM_Startup()
PMStarted = true; PMStarted = true;
} }
//
// PM_Shutdown() - Shut down the Page Mgr
//
void PM_Shutdown() void PM_Shutdown()
{ {
if (!PMStarted) if (!PMStarted)
......
...@@ -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