Commit c5dd2f30 authored by Steven Fuller's avatar Steven Fuller

Code cleanups.

parent 7289833d
......@@ -2,32 +2,33 @@ CC = gcc
#CC = g++
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall
CFLAGS = -g
CFLAGS = -g -Wall
#CFLAGS = -g
#CFLAGS = -Os
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 \
wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
wl_debug.o gfxsave.o sd_oal.o # sd_null.o
wl_debug.o gfxsave.o sd_null.o # sd_oal.o # sd_null.o
ROBJS = wl_draw.o wl_scale.o
SOBJS = $(OBJS) $(ROBJS) vi_svga.o
XOBJS = $(OBJS) $(ROBJS) vi_xlib.o
GOBJS = $(OBJS) vi_ogl.o vi_glx.o
#GOBJS = $(OBJS) vi_ogl.o vi_glx.o
#LFLAGS = -lm
LFLAGS = -lm /home/relnev/cvs/oal/linux/src/libopenal.a -lpthread -ldl
LFLAGS = -lm
#LFLAGS = -lm /home/relnev/cvs/oal/linux/src/libopenal.a -lpthread -ldl
SLFLAGS = $(LFLAGS) -lvga
XLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga
GLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lGL
#GLFLAGS = $(LFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lGL
NASM = nasm
.SUFFIXES: .asm
all: swolf3d xwolf3d gwolf3d
#all: swolf3d xwolf3d gwolf3d
all: swolf3d xwolf3d
$(SOBJS): version.h id_heads.h wl_def.h
$(XOBJS): version.h id_heads.h wl_def.h
......@@ -52,4 +53,4 @@ distclean: clean
rm -rf *~ DEADJOE
forced: distclean all
rm -rf *.o
# rm -rf *.o
Just some random facts/thoughts/ideas/musings:
http://www.warzone.com/fullnews/902317374.shtml
* Wolfenstein 3D for:
- PC (released, of course) [May 5, 1992]
- PC Spear of Destiny 1992
- PC (Spear of Destiny) [Late 1992]
- SNES
- Macintosh
- Jaguar
- Apple IIGS
- 3DO (? - not mentioned in apogee faq, but you can find cheatcodes for it)
- 3DO
* Rumored/Never Released?
- Atari Lynx
- Sega Genesis
- Sega Genesis (was cancelled after a month)
- Japanese PC Version
- Spanish PC Version
- Japanese Mac Version
* Unofficial ports:
- Linux (this, xwolf, wolfgl)
- Amiga (port of my first pc wolf3d linux port)
- Windows (wolfgl)
- Acorn/Archemedes
* PC source released on:
- now many ports, projects, etc
- urls
* Mac source released January 22(?), 2000
* Macintosh source released January 22(?), 2000
- url
* TED source (editor used for tons of games including wolf3d)
......@@ -32,5 +33,5 @@ Wolfenstein 3D was originally planned to be a much more complex game. ...
... lots of unused code ... possibly from previous projects and incarnations
of wolf3d.
1.4 of Wolfenstein 3D (full) had a Read Me! option. The text still exists in
the data file, but all the graphics are off.
Version 1.4 of Wolfenstein 3D (full) had a Read Me! option. The text still
exists in the data files, but all the graphics are incorrect.
------------- Please Disregard the Following Outdated Text: ----------------
General:
* inconsistancy:
id_ca.c has code for setting the data filenames' extension
......
......@@ -887,7 +887,7 @@ void CAL_ExpandGrChunk(int chunk, byte *source)
//
// allocate final space and decompress it
//
MM_GetPtr(&grsegs[chunk], expanded);
MM_GetPtr((void *)&grsegs[chunk], expanded);
CAL_HuffExpand(source, grsegs[chunk], expanded, grhuffman);
if (width && height) {
if (tilecount) {
......@@ -912,18 +912,17 @@ void CAL_ExpandGrChunk(int chunk, byte *source)
void CA_CacheGrChunk(int chunk)
{
long pos,compressed;
byte *source;
int next;
long pos, compressed;
byte *source;
int next;
/* this is due to Quit wanting to cache the error screen before this has been set up! */
if ( (grhandle == 0) || (grhandle == -1) ) /* make sure this works ok */
return;
grneeded[chunk] |= ca_levelbit; /* make sure it doesn't get removed */
if (grsegs[chunk])
{
MM_SetPurge (&grsegs[chunk], 0);
if (grsegs[chunk]) {
return;
}
......@@ -957,7 +956,7 @@ void CA_UnCacheGrChunk(int chunk)
return;
}
MM_FreePtr(&grsegs[chunk]);
MM_FreePtr((void *)&grsegs[chunk]);
grneeded[chunk] &= ~ca_levelbit;
/* Or should MM_FreePtr set it to zero? */
......@@ -1567,19 +1566,6 @@ memptr PM_GetPage(int pagenum)
return page->addr;
}
//
// PM_SetPageLock() - Sets the lock type on a given page
// pml_Unlocked: Normal, page can be purged
// pml_Locked: Cannot be purged
//
void PM_SetPageLock(int pagenum,PMLockType lock)
{
if (pagenum < PMSoundStart)
Quit("PM_SetPageLock: Locking/unlocking non-sound page");
PMPages[pagenum].locked = lock;
}
//
// PM_Preload() - Loads as many pages as possible into all types of memory.
// Calls the update function after each load, indicating the current
......@@ -1616,16 +1602,15 @@ void PM_NextFrame(void)
//
// PM_Reset() - Sets up caching structures
//
void PM_Reset(void)
void PM_Reset()
{
int i;
PageListStruct *page;
// Initialize page list
for (i = 0,page = PMPages;i < PMNumBlocks;i++,page++)
for (i = 0, page = PMPages; i < PMNumBlocks; i++, page++)
{
page->addr = NULL;
page->locked = false;
}
}
......
#ifndef __ID_CA_H__
#define __ID_CA_H__
//===========================================================================
/* ======================================================================== */
#define NUMMAPS 60
#define MAPPLANES 2
#define UNCACHEGRCHUNK CA_UnCacheGrChunk
//===========================================================================
typedef struct
......@@ -75,41 +73,34 @@ void CA_ClearAllMarks (void);
#define CA_MarkGrChunk(chunk) grneeded[chunk]|=ca_levelbit
void CA_CacheMarks (void);
void CA_CacheMarks();
*/
void CA_CacheScreen (int chunk);
void CA_CacheScreen(int chunk);
//==========================================================================
void MM_Startup (void);
void MM_Shutdown (void);
void MM_Startup();
void MM_Shutdown();
void MM_GetPtr (memptr *baseptr, unsigned long size);
void MM_FreePtr (memptr *baseptr);
void MM_GetPtr(memptr *baseptr, unsigned long size);
void MM_FreePtr(memptr *baseptr);
void MM_SetPurge (memptr *baseptr, int purge);
void MM_SetLock (memptr *baseptr, boolean locked);
void MM_SortMem (void);
void MM_SetPurge(memptr *baseptr, int purge);
void MM_SetLock(memptr *baseptr, boolean locked);
void MM_SortMem();
#define PMPageSize 4096
typedef enum
{
pml_Unlocked,
pml_Locked
} PMLockType;
#define PMPageSize 4096
typedef struct {
longword offset; // Offset of chunk into file
word length; // Length of the chunk
PMLockType locked; // If set, this page cannot be purged
memptr addr;
longword lastHit; // Last frame number of hit
} PageListStruct;
extern word ChunksInFile,
PMSpriteStart,PMSoundStart;
extern word ChunksInFile, PMSpriteStart, PMSoundStart;
extern PageListStruct *PMPages;
#define PM_GetSoundPage(v) PM_GetPage(PMSoundStart + (v))
......@@ -123,11 +114,7 @@ void PM_Startup(void),
PM_Reset(void),
PM_Preload(boolean (*update)(word current,word total)),
PM_NextFrame(void),
PM_SetPageLock(int pagenum,PMLockType lock),
PM_SetMainPurge(int level),
PM_CheckMainMem(void);
PM_SetMainPurge(int level);
memptr PM_GetPageAddress(int pagenum), PM_GetPage(int pagenum);
#else
#error "fix me TODO"
#endif
......@@ -127,6 +127,4 @@ extern byte fontcolor,backcolor;
#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
#else
#error "fix me: TODO"
#endif
......@@ -42,6 +42,4 @@ int US_RndT();
void USL_PrintInCenter(char *s,Rect r);
#else
#error "fix me: TODO"
#endif
......@@ -54,6 +54,4 @@ void VL_FadeIn(int start, int end, const byte *palette, int steps);
void LatchDrawPic(unsigned x, unsigned y, unsigned picnum);
void LoadLatchMem(void);
#else
#error "fix me: TODO"
#endif
......@@ -24,6 +24,4 @@ char *ultoa(unsigned long value, char *string, int radix);
#endif /* DOSISM */
#else
#error "fix me TODO"
#endif
......@@ -13,95 +13,41 @@ typedef enum {
typedef enum {
sds_Off,sds_PC,sds_SoundSource,sds_SoundBlaster
} SDSMode;
typedef struct
{
longword length;
word priority;
} SoundCommon;
typedef struct
{
SoundCommon common;
byte data[1];
} PCSound;
typedef struct
{
byte mChar,cChar,
mScale,cScale,
mAttack,cAttack,
mSus,cSus,
mWave,cWave,
nConn,
// These are only for Muse - these bytes are really unused
voice,
mode,
unused[3];
} Instrument;
typedef struct
{
SoundCommon common;
Instrument inst;
byte block,
data[1];
} AdLibSound;
typedef struct {
longword length;
word priority;
} PACKED SoundCommon;
//
// Sequencing stuff
//
#define sqMaxTracks 10
#define sqMaxMoods 1 // DEBUG
typedef struct {
SoundCommon common;
byte data[1];
} PACKED PCSound;
#define sev_Null 0 // Does nothing
#define sev_NoteOff 1 // Turns a note off
#define sev_NoteOn 2 // Turns a note on
#define sev_NotePitch 3 // Sets the pitch of a currently playing note
#define sev_NewInst 4 // Installs a new instrument
#define sev_NewPerc 5 // Installs a new percussive instrument
#define sev_PercOn 6 // Turns a percussive note on
#define sev_PercOff 7 // Turns a percussive note off
#define sev_SeqEnd -1 // Terminates a sequence
typedef struct {
byte mChar, cChar, mScale, cScale, mAttack, cAttack, mSus, cSus,
mWave, cWave, nConn, voice, mode, unused[3];
} PACKED Instrument;
// Flags for MusicGroup.flags
#define sf_Melodic 0
#define sf_Percussive 1
typedef struct {
SoundCommon common;
Instrument inst;
byte block, data[1];
} AdLibSound;
typedef struct {
word length, values[1];
} PACKED MusicGroup;
typedef struct
{
/* This part needs to be set up by the user */
word mood, *moods[sqMaxMoods];
/* The rest is set up by the code */
Instrument inst;
boolean percussive;
word *seq;
longword nextevent;
} ActiveTrack;
#define sqmode_Normal 0
#define sqmode_FadeIn 1
#define sqmode_FadeOut 2
#define sqMaxFade 64 // DEBUG
// Global variables
extern boolean AdLibPresent,
SoundSourcePresent,
SoundBlasterPresent,
NeedsMusic, // For Caching Mgr
SoundPositioned;
extern SDMode SoundMode;
extern SDSMode DigiMode;
extern SMMode MusicMode;
extern boolean DigiPlaying;
extern int DigiMap[];
extern int DigiMap[];
// Function prototypes
extern void SD_Startup(void), SD_Shutdown(void);
......@@ -119,12 +65,10 @@ extern boolean SD_MusicPlaying(void),
SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void);
extern void SD_SetDigiDevice(SDSMode),
SD_Poll(void);
extern void SD_SetDigiDevice(SDSMode);
extern void SD_Poll();
void PlaySoundLocGlobal(word s, fixed gx, fixed gy);
void UpdateSoundLoc(fixed x, fixed y, int angle);
#else
#error "fix me TODO"
#endif
......@@ -2,90 +2,41 @@
#include "id_heads.h"
// Global variables
boolean SoundSourcePresent,
AdLibPresent,
SoundBlasterPresent,SBProPresent,
NeedsDigitized,NeedsMusic,
SoundPositioned;
SDMode SoundMode;
SMMode MusicMode;
SDSMode DigiMode;
word *SoundTable;
word ssPort = 2;
int DigiMap[LASTSOUND];
// Internal variables
static boolean SD_Started;
boolean nextsoundpos;
soundnames SoundNumber,DigiNumber;
word SoundPriority,DigiPriority;
int LeftPosition,RightPosition;
word NumDigi,DigiLeft,DigiPage;
word *DigiList;
word DigiLastStart,DigiLastEnd;
boolean DigiPlaying;
static boolean DigiMissed,DigiLastSegment;
static memptr DigiNextAddr;
static word DigiNextLen;
// SoundBlaster variables
static boolean sbNoCheck,sbNoProCheck;
static byte sbOldIntMask = -1;
static byte *sbNextSegPtr;
static longword sbNextSegLen;
// SoundSource variables
boolean ssNoCheck;
boolean ssActive;
word ssControl,ssStatus,ssData;
byte ssOn,ssOff;
byte *ssSample;
longword ssLengthLeft;
// PC Sound variables
volatile byte pcLastSample, *pcSound;
longword pcLengthLeft;
word pcSoundLookup[255];
// AdLib variables
boolean alNoCheck;
byte *alSound;
word alBlock;
longword alLengthLeft;
Instrument alZeroInst;
// Sequencer variables
boolean sqActive;
static word alFXReg;
static ActiveTrack *tracks[sqMaxTracks],
mytracks[sqMaxTracks];
static word sqMode,sqFadeStep;
word *sqHack, *sqHackPtr,sqHackLen,sqHackSeqLen;
long sqHackTime;
// Internal routines
void SDL_DigitizedDone(void);
void SD_StopDigitized(void)
{
}
boolean SoundSourcePresent, AdLibPresent, SoundBlasterPresent,
SoundPositioned;
SDMode SoundMode, MusicMode;
SDSMode DigiMode;
int DigiMap[LASTSOUND];
static boolean SD_Started;
boolean nextsoundpos;
int LeftPosition, RightPosition;
word NumDigi;
word *DigiList;
boolean DigiPlaying;
boolean sqActive;
void SD_Poll(void)
void SD_StopDigitized()
{
}
void SD_SetPosition(int leftpos,int rightpos)
void SD_Poll()
{
}
void SD_PlayDigitized(word which,int leftpos,int rightpos)
void SD_SetPosition(int leftpos, int rightpos)
{
}
void SDL_DigitizedDone(void)
void SD_PlayDigitized(word which, int leftpos, int rightpos)
{
}
......
......@@ -5,67 +5,29 @@
#include <AL/al.h>
#include <AL/alc.h>
#error "This code is out of date/broken"
// Global variables
boolean SoundSourcePresent,
AdLibPresent,
SoundBlasterPresent,SBProPresent,
NeedsDigitized,NeedsMusic,
SoundBlasterPresent,
SoundPositioned;
SDMode SoundMode;
SMMode MusicMode;
SDSMode DigiMode;
word *SoundTable;
word ssPort = 2;
int DigiMap[LASTSOUND];
// Internal variables
static boolean SD_Started;
boolean nextsoundpos;
soundnames SoundNumber,DigiNumber;
word SoundPriority,DigiPriority;
int LeftPosition,RightPosition;
word NumDigi,DigiLeft,DigiPage;
word NumDigi;
word *DigiList;
word DigiLastStart,DigiLastEnd;
boolean DigiPlaying;
static boolean DigiMissed,DigiLastSegment;
static memptr DigiNextAddr;
static word DigiNextLen;
// SoundBlaster variables
static boolean sbNoCheck,sbNoProCheck;
static byte sbOldIntMask = -1;
static byte *sbNextSegPtr;
static longword sbNextSegLen;
// SoundSource variables
boolean ssNoCheck;
boolean ssActive;
word ssControl,ssStatus,ssData;
byte ssOn,ssOff;
byte *ssSample;
longword ssLengthLeft;
// PC Sound variables
volatile byte pcLastSample, *pcSound;
longword pcLengthLeft;
word pcSoundLookup[255];
// AdLib variables
boolean alNoCheck;
byte *alSound;
word alBlock;
longword alLengthLeft;
Instrument alZeroInst;
// Sequencer variables
boolean sqActive;
static word alFXReg;
static ActiveTrack *tracks[sqMaxTracks],
mytracks[sqMaxTracks];
static word sqMode,sqFadeStep;
/* ------------------------------------------------------------------------ */
......
......@@ -41,6 +41,4 @@
#error "please edit version.h and fix WMODE"
#endif
#else
#error "fix me: TODO"
#endif
......@@ -187,6 +187,4 @@ void INL_GetJoyDelta(word joy,int *dx,int *dy);
void IN_StartAck(void);
boolean IN_CheckAck (void);
#else
#error "fix me TODO"
#endif
......@@ -14,6 +14,8 @@
#include <GL/gl.h>
#include <GL/glx.h>
#error "This code is out of date/broken"
byte *gfxbuf = NULL;
Display *dpy;
......
......@@ -4,6 +4,8 @@
#include <GL/gl.h>
#error "This code is out of date/broken"
// the door is the last picture before the sprites
#define DOORWALL (PMSpriteStart-8)
......
......@@ -5,6 +5,8 @@
#include <dinput.h>
#include <direct.h>
#error "This code is out of date/broken"
byte *gfxbuf = NULL;
HWND win;
......
......@@ -459,7 +459,7 @@ void VW_UpdateScreen()
word *ptrs;
byte *ptrb, *ptrbd;
int i, j;
int i;
if (dga) {
switch(vi->depth) {
......
......@@ -1134,6 +1134,4 @@ void SpawnHitler (int tilex, int tiley);
extern void HelpScreens(void);
extern void EndText(void);
#else
#error "fix me TODO"
#endif
......@@ -42,6 +42,17 @@ long xstep,ystep;
void AsmRefresh (void);
void xBuildCompScale(int height, byte *source, int x);
#ifndef NOASM
#define FixedByFrac(x, y) \
({ unsigned long z; \
asm("imull %2; shrdl $16, %%edx, %%eax" : "=a" (z) : "a" (x), "q" (y) : "%edx"); \
z; \
})
#endif
#define xpartialbyystep() FixedByFrac(xpartial, ystep)
#define ypartialbyxstep() FixedByFrac(ypartial, xstep)
//==========================================================================
/*
......@@ -193,7 +204,7 @@ boolean TransformTile (int tx, int ty, int *dispx, int *dispheight)
*/
int CalcHeight (void)
int CalcHeight()
{
fixed gxt,gyt,nx,gx,gy;
......@@ -298,10 +309,9 @@ void HitVertDoor()
wallheight[pixx] = CalcHeight();
postx = pixx;
postx = pixx;
switch (doorobjlist[doornum].lock)
{
switch (doorobjlist[doornum].lock) {
case dr_normal:
doorpage = DOORWALL;
break;
......@@ -314,15 +324,15 @@ void HitVertDoor()
case dr_elevator:
doorpage = DOORWALL+4;
break;
}
}
wall = PM_GetPage (doorpage);
ScalePost (wall, texture);
wall = PM_GetPage(doorpage);
ScalePost(wall, texture);
}
//==========================================================================
/* ======================================================================== */
unsigned Ceiling[]=
unsigned int Ceiling[]=
{
#ifndef SPEAR
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,
......@@ -348,11 +358,11 @@ unsigned Ceiling[]=
void ClearScreen()
{
unsigned ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned floor = 0x19;
unsigned int ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned int floor = 0x19;
VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling);
VL_Bar(xoffset, yoffset + viewheight / 2, viewwidth, viewheight / 2, floor);
VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling);
VL_Bar(xoffset, yoffset + viewheight / 2, viewwidth, viewheight / 2, floor);
}
//==========================================================================
......@@ -411,9 +421,9 @@ typedef struct
shapenum;
} visobj_t;
visobj_t vislist[MAXVISABLE],*visptr,*visstep,*farthest;
visobj_t vislist[MAXVISABLE],*visptr,*visstep,*farthest;
void DrawScaleds (void)
void DrawScaleds()
{
int i,least,numvisable,height;
byte *tilespot,*visspot;
......@@ -649,14 +659,12 @@ void ThreeDRefresh()
//===========================================================================
/* xpartial = 16 bit fraction
/*
xpartial = 16 bit fraction
ystep = 32 bit fixed 32,16
*/
#define xpartialbyystep() FixedByFrac(xpartial, ystep)
#define ypartialbyxstep() FixedByFrac(ypartial, xstep)
*/
int samex (int intercept, int tile)
static int samex(int intercept, int tile)
{
if (xtilestep > 0) {
if ((intercept>>16) >= tile)
......@@ -671,7 +679,7 @@ int samex (int intercept, int tile)
}
}
int samey (int intercept, int tile)
static int samey(int intercept, int tile)
{
if (ytilestep > 0) {
if ((intercept>>16) >= tile)
......
......@@ -848,7 +848,6 @@ void PlayDemo(int demonumber)
CA_CacheGrChunk(dems[demonumber]);
demoptr = grsegs[dems[demonumber]];
MM_SetLock (&grsegs[dems[demonumber]],true);
NewGame (1,0);
gamestate.mapon = *demoptr++;
......@@ -874,7 +873,7 @@ void PlayDemo(int demonumber)
PlayLoop ();
UNCACHEGRCHUNK(dems[demonumber]);
CA_UnCacheGrChunk(dems[demonumber]);
demoplayback = false;
......
......@@ -12,7 +12,7 @@
==================
*/
void ClearSplitVWB (void)
void ClearSplitVWB()
{
WindowX = 0;
WindowY = 0;
......@@ -37,7 +37,7 @@ void EndScreen (int palette, int screen)
VW_UpdateScreen ();
CA_CacheGrChunk (palette);
VL_FadeIn(0,255,grsegs[palette],30);
UNCACHEGRCHUNK (palette);
CA_UnCacheGrChunk (palette);
IN_ClearKeysDown ();
IN_Ack ();
VW_FadeOut ();
......@@ -52,7 +52,7 @@ void EndSpear(void)
VW_UpdateScreen ();
CA_CacheGrChunk (END3PALETTE);
VL_FadeIn(0,255,grsegs[END3PALETTE],30);
UNCACHEGRCHUNK (END3PALETTE);
CA_UnCacheGrChunk (END3PALETTE);
fontnumber = 0;
fontcolor = 0xd0;
WindowX = 0;
......@@ -138,10 +138,10 @@ void Victory (void)
VW_UpdateScreen ();
VW_WaitVBL(3*70);
UNCACHEGRCHUNK(BJCOLLAPSE1PIC);
UNCACHEGRCHUNK(BJCOLLAPSE2PIC);
UNCACHEGRCHUNK(BJCOLLAPSE3PIC);
UNCACHEGRCHUNK(BJCOLLAPSE4PIC);
CA_UnCacheGrChunk(BJCOLLAPSE1PIC);
CA_UnCacheGrChunk(BJCOLLAPSE2PIC);
CA_UnCacheGrChunk(BJCOLLAPSE3PIC);
CA_UnCacheGrChunk(BJCOLLAPSE4PIC);
VL_FadeOut (0,255,0,17,17,5);
#endif
......@@ -261,7 +261,7 @@ void PG13 (void)
VWB_DrawPic (216,110,PG13PIC);
VW_UpdateScreen ();
UNCACHEGRCHUNK (PG13PIC);
CA_UnCacheGrChunk (PG13PIC);
VW_FadeIn();
IN_UserInput(TickBase*7);
......@@ -825,7 +825,7 @@ void LevelCompleted()
"of Spear of Destiny! Now,\n"
"go to your local software\n"
"store and buy it!");
UNCACHEGRCHUNK (STARTFONT+1);
CA_UnCacheGrChunk (STARTFONT+1);
IN_ClearKeysDown();
IN_Ack();
......@@ -910,31 +910,32 @@ void PreloadGraphics()
void DrawHighScores()
{
char buffer[16],*str,buffer1[5];
word i,w,h;
HighScore *s;
MM_SortMem ();
char buffer[16];
char buffer1[16], *str;
word i, w, h;
HighScore *s;
buffer1[0] = 0;
str = 0;
#ifndef SPEAR
CA_CacheGrChunk (HIGHSCORESPIC);
CA_CacheGrChunk (STARTFONT);
CA_CacheGrChunk (C_LEVELPIC);
CA_CacheGrChunk (C_SCOREPIC);
CA_CacheGrChunk (C_NAMEPIC);
CA_CacheGrChunk(HIGHSCORESPIC);
CA_CacheGrChunk(STARTFONT);
CA_CacheGrChunk(C_LEVELPIC);
CA_CacheGrChunk(C_SCOREPIC);
CA_CacheGrChunk(C_NAMEPIC);
ClearMScreen();
DrawStripes(10);
VWB_DrawPic(48,0,HIGHSCORESPIC);
UNCACHEGRCHUNK (HIGHSCORESPIC);
CA_UnCacheGrChunk(HIGHSCORESPIC);
VWB_DrawPic(4*8,68,C_NAMEPIC);
VWB_DrawPic(20*8,68,C_LEVELPIC);
VWB_DrawPic(28*8,68,C_SCOREPIC);
fontnumber=0;
fontnumber = 0;
#else
CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
ClearMScreen();
......@@ -948,14 +949,13 @@ void DrawHighScores()
fontnumber = 1;
#endif
#ifndef SPEAR
SETFONTCOLOR(15,0x29);
#else
SETFONTCOLOR(HIGHLIGHT,0x29);
#endif
for (i = 0,s = Scores;i < MaxScores;i++,s++)
for (i = 0, s = Scores; i < MaxScores; i++, s++)
{
PrintY = 76 + (16 * i);
......@@ -1003,21 +1003,20 @@ void DrawHighScores()
//
// score
//
ultoa(s->score,buffer,10);
ultoa(s->score, buffer1, 10);
#ifndef SPEAR
for (str = buffer;*str;str++)
for (str = buffer; *str; str++)
*str = *str + (129 - '0'); // Used fixed-width numbers (129...)
USL_MeasureString(buffer,&w,&h);
USL_MeasureString(buffer, &w, &h);
PrintX = (34 * 8) - 8 - w;
#else
USL_MeasureString(buffer,&w,&h);
USL_MeasureString(buffer, &w, &h);
PrintX = 292 - w;
#endif
US_Print(buffer);
}
VW_UpdateScreen ();
VW_UpdateScreen();
#ifdef SPEAR
UnCacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);
......@@ -1467,8 +1466,8 @@ void CopyProtection(void)
SD_PlaySound(BONUS1UPSND);
SD_WaitSoundDone();
UNCACHEGRCHUNK (STARTFONT+1);
UNCACHEGRCHUNK (C_BACKDROPPIC);
CA_UnCacheGrChunk (STARTFONT+1);
CA_UnCacheGrChunk (C_BACKDROPPIC);
UnCacheLump (COPYPROT_LUMP_START,COPYPROT_LUMP_END);
switch(SoundMode)
......
......@@ -131,14 +131,15 @@ void CalcTics()
====================
*/
void ReadConfig(void)
void ReadConfig()
{
int file;
SDMode sd;
SMMode sm;
SDSMode sds;
SDMode sd;
SMMode sm;
SDSMode sds;
#if 0 /* TODO */
int file;
if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)
{
//
......@@ -1078,7 +1079,7 @@ void InitGame(void)
//
InitDigiMap ();
for (i=0;i<MAPSIZE;i++)
for (i = 0;i < MAPSIZE; i++)
{
farmapylookup[i] = i*64;
}
......@@ -1100,11 +1101,10 @@ void InitGame(void)
//
CA_CacheGrChunk(STARTFONT);
MM_SetLock (&grsegs[STARTFONT],true);
LoadLatchMem ();
BuildTables (); // trig tables
SetupWalls ();
LoadLatchMem();
BuildTables(); // trig tables
SetupWalls();
NewViewSize(viewsize);
......@@ -1232,15 +1232,15 @@ void DemoLoop (void)
CA_CacheGrChunk (TITLE1PIC);
VWB_DrawPic (0,0,TITLE1PIC);
UNCACHEGRCHUNK (TITLE1PIC);
CA_UnCacheGrChunk (TITLE1PIC);
CA_CacheGrChunk (TITLE2PIC);
VWB_DrawPic (0,80,TITLE2PIC);
UNCACHEGRCHUNK (TITLE2PIC);
CA_UnCacheGrChunk (TITLE2PIC);
VW_UpdateScreen ();
VL_FadeIn(0,255,grsegs[TITLEPALETTE],30);
UNCACHEGRCHUNK (TITLEPALETTE);
CA_UnCacheGrChunk (TITLEPALETTE);
#else
CA_CacheScreen (TITLEPIC);
VW_UpdateScreen ();
......
......@@ -318,17 +318,17 @@ void US_ControlPanel(byte scancode)
CA_CacheGrChunk (IDGUYS1PIC);
VWB_DrawPic(0,0,IDGUYS1PIC);
UNCACHEGRCHUNK(IDGUYS1PIC);
CA_UnCacheGrChunk(IDGUYS1PIC);
CA_CacheGrChunk (IDGUYS2PIC);
VWB_DrawPic(0,80,IDGUYS2PIC);
UNCACHEGRCHUNK(IDGUYS2PIC);
CA_UnCacheGrChunk(IDGUYS2PIC);
VW_UpdateScreen();
CA_CacheGrChunk (IDGUYSPALETTE);
VL_FadeIn(0,255,grsegs[IDGUYSPALETTE],30);
UNCACHEGRCHUNK(IDGUYSPALETTE);
CA_UnCacheGrChunk(IDGUYSPALETTE);
while (Keyboard[sc_I] || Keyboard[sc_D]) IN_CheckAck();
IN_ClearKeysDown();
......@@ -570,12 +570,12 @@ int CP_CheckQuick(unsigned scancode)
#ifndef SPEAR
UNCACHEGRCHUNK(C_CURSOR1PIC);
UNCACHEGRCHUNK(C_CURSOR2PIC);
UNCACHEGRCHUNK(C_DISKLOADING1PIC);
UNCACHEGRCHUNK(C_DISKLOADING2PIC);
UNCACHEGRCHUNK(C_SAVEGAMEPIC);
UNCACHEGRCHUNK(C_MOUSELBACKPIC);
CA_UnCacheGrChunk(C_CURSOR1PIC);
CA_UnCacheGrChunk(C_CURSOR2PIC);
CA_UnCacheGrChunk(C_DISKLOADING1PIC);
CA_UnCacheGrChunk(C_DISKLOADING2PIC);
CA_UnCacheGrChunk(C_SAVEGAMEPIC);
CA_UnCacheGrChunk(C_MOUSELBACKPIC);
#else
UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
#endif
......@@ -639,12 +639,12 @@ int CP_CheckQuick(unsigned scancode)
lasttimecount = get_TimeCount();
#ifndef SPEAR
UNCACHEGRCHUNK(C_CURSOR1PIC);
UNCACHEGRCHUNK(C_CURSOR2PIC);
UNCACHEGRCHUNK(C_DISKLOADING1PIC);
UNCACHEGRCHUNK(C_DISKLOADING2PIC);
UNCACHEGRCHUNK(C_LOADGAMEPIC);
UNCACHEGRCHUNK(C_MOUSELBACKPIC);
CA_UnCacheGrChunk(C_CURSOR1PIC);
CA_UnCacheGrChunk(C_CURSOR2PIC);
CA_UnCacheGrChunk(C_DISKLOADING1PIC);
CA_UnCacheGrChunk(C_DISKLOADING2PIC);
CA_UnCacheGrChunk(C_LOADGAMEPIC);
CA_UnCacheGrChunk(C_MOUSELBACKPIC);
#else
UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
#endif
......
......@@ -223,6 +223,4 @@ extern LRstruct LevelRatios[];
void Write (int x,int y,char *string);
int GetYorN(int x,int y,int pic);
#else
#error "fix me TODO"
#endif
......@@ -673,20 +673,18 @@ int helpextern = T_HELPART;
=
=================
*/
void HelpScreens (void)
void HelpScreens()
{
int artnum;
char *text;
CA_UpLevel ();
MM_SortMem ();
CA_UpLevel();
artnum = helpextern;
CA_CacheGrChunk (artnum);
CA_CacheGrChunk(artnum);
text = (char *)grsegs[artnum];
MM_SetLock (&grsegs[artnum], true);
ShowArticle (text);
ShowArticle(text);
CA_UnCacheGrChunk(artnum);
......@@ -694,28 +692,25 @@ void HelpScreens (void)
FreeMusic();
CA_DownLevel();
MM_SortMem();
}
//
// END ARTICLES
//
void EndText (void)
void EndText()
{
int artnum;
char *text;
ClearMemory ();
ClearMemory();
CA_UpLevel ();
MM_SortMem ();
CA_UpLevel();
artnum = endextern+gamestate.episode;
CA_CacheGrChunk (artnum);
text = (char *)grsegs[artnum];
MM_SetLock (&grsegs[artnum], true);
ShowArticle (text);
ShowArticle(text);
CA_UnCacheGrChunk(artnum);
......@@ -725,7 +720,6 @@ void EndText (void)
FreeMusic();
CA_DownLevel();
MM_SortMem();
}
#endif
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