Commit c5dd2f30 authored by Steven Fuller's avatar Steven Fuller

Code cleanups.

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