- SW compiles.

This required taking lots of function prototypes out of functions because they won't get a namespace in there.
This commit is contained in:
Christoph Oelckers 2019-10-09 19:58:09 +02:00
parent 70004665fd
commit 0f4abfa4f4
41 changed files with 185 additions and 1803 deletions

View file

@ -544,9 +544,11 @@ set( PLAT_WIN32_SOURCES
duke3d/src/startwin.game.cpp
rr/src/startwin.game.cpp
blood/src/startwin.game.cpp
sw/src/startwin.game.cpp
# This needs a rework anyway in order to consolidate the startup dialogs so don't bother to sort in properly.
#startgtk.game.cpp
#startosx.game.mm
#sw/src/startgtk.game.cpp
)
@ -962,10 +964,10 @@ set (PCH_SOURCES
sw/src/actor.cpp
sw/src/ai.cpp
sw/src/anim.cpp
sw/src/bldscript.cpp
#sw/src/bldscript.cpp
sw/src/border.cpp
sw/src/break.cpp
sw/src/brooms.cpp
#sw/src/brooms.cpp
sw/src/bunny.cpp
sw/src/cache.cpp
sw/src/cheats.cpp
@ -987,7 +989,7 @@ set (PCH_SOURCES
sw/src/interp.cpp
sw/src/interpsh.cpp
sw/src/inv.cpp
sw/src/jbhlp.cpp
#sw/src/jbhlp.cpp
sw/src/jplayer.cpp
sw/src/jsector.cpp
sw/src/jweapon.cpp
@ -1021,8 +1023,6 @@ set (PCH_SOURCES
sw/src/sounds.cpp
sw/src/spike.cpp
sw/src/sprite.cpp
sw/src/startgtk.game.cpp
sw/src/startwin.game.cpp
sw/src/sumo.cpp
sw/src/swconfig.cpp
sw/src/sync.cpp

View file

@ -46,6 +46,7 @@ BEGIN_SW_NS
SWBOOL PlayerTakeDamage(PLAYERp, short);
ANIMATOR InitActorRunToward;
SWBOOL FAF_Sector(short);
SWBOOL DropAhead(short SpriteNum, short min_height);
short FindTrackToPlayer(USERp u);
ANIMATORp ChooseAction(DECISION decision[]);
@ -1773,7 +1774,6 @@ FindNewAngle(short SpriteNum, signed char dir, int DistToMove)
{
USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL DropAhead(short SpriteNum, short min_height);
static short toward_angle_delta[4][9] =
{

View file

@ -23,7 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
BEGIN_SW_NS
#ifdef AMBIENT_TABLE
#define AMB_ENTRY(name, diginame, ambient_flags, maxtics) {name, diginame, ambient_flags, maxtics},
@ -214,4 +213,3 @@ AMB_ENTRY(81, DIGI_SHIPBELL, AMB_INTERMIT, AMB_30)
AMB_ENTRY(82, DIGI_FOGHORN, AMB_INTERMIT, AMB_120)
#undef AMB_ENTRY
END_SW_NS

View file

@ -1,646 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2005 - 3D Realms Entertainment
This file is NOT part of Shadow Warrior version 1.2
However, it is either an older version of a file that is, or is
some test code written during the development of Shadow Warrior.
This file is provided purely for educational interest.
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
// scriplib.c
#include "build.h"
#include "editor.h"
#include "cache1d.h"
#include "names2.h"
#include "game.h"
#include "parse.h"
#define PATHSEPERATOR '\\'
BEGIN_SW_NS
//#define COMPUTE_TOTALS 1
/*
=============================================================================
ABNORMAL TERMINATION
=============================================================================
*/
void Error(const char *error, ...)
{
va_list argptr;
va_start(argptr,error);
vprintf(error,argptr);
va_end(argptr);
printf("\n");
exit(1);
}
/*
=============================================================================
PARSING STUFF
=============================================================================
*/
char token[MAXTOKEN];
char *scriptbuffer,*script_p,*scriptend_p;
int grabbed;
int scriptline;
SWBOOL endofscript;
SWBOOL tokenready; // only TRUE if UnGetToken was just called
/*
==============
=
= LoadScriptFile
=
==============
*/
SWBOOL LoadScriptFile(const char *filename)
{
int size, readsize;
int fp;
if ((fp=kopen4load(filename,0)) == -1)
{
// If there's no script file, forget it.
return FALSE;
}
size = kfilelength(fp);
scriptbuffer = (char *)malloc(size);
ASSERT(scriptbuffer != NULL);
readsize = kread(fp, scriptbuffer, size);
kclose(fp);
ASSERT(readsize == size);
// Convert filebuffer to all upper case
//strupr(scriptbuffer);
script_p = scriptbuffer;
scriptend_p = script_p + size;
scriptline = 1;
endofscript = FALSE;
tokenready = FALSE;
return TRUE;
}
/*
==============
=
= UnGetToken
=
= Signals that the current token was not used, and should be reported
= for the next GetToken. Note that
GetToken (TRUE);
UnGetToken ();
GetToken (FALSE);
= could cross a line boundary.
=
==============
*/
void UnGetToken(void)
{
tokenready = TRUE;
}
/*
==============
=
= GetToken
=
==============
*/
void GetToken(SWBOOL crossline)
{
char *token_p;
if (tokenready) // is a token already waiting?
{
tokenready = FALSE;
return;
}
if (script_p >= scriptend_p)
{
if (!crossline)
Error("Line %i is incomplete\n",scriptline);
endofscript = TRUE;
return;
}
//
// skip space
//
skipspace:
while (*script_p <= 32)
{
if (script_p >= scriptend_p)
{
if (!crossline)
Error("Line %i is incomplete\n",scriptline);
endofscript = TRUE;
return;
}
if (*script_p++ == '\n')
{
if (!crossline)
Error("Line %i is incomplete\n",scriptline);
scriptline++;
}
}
if (script_p >= scriptend_p)
{
if (!crossline)
Error("Line %i is incomplete\n",scriptline);
endofscript = TRUE;
return;
}
if (*script_p == '#') // # is comment field
{
if (!crossline)
Error("Line %i is incomplete\n",scriptline);
while (*script_p++ != '\n')
if (script_p >= scriptend_p)
{
endofscript = TRUE;
return;
}
goto skipspace;
}
//
// copy token
//
token_p = token;
while (*script_p > 32 && *script_p != '#')
{
*token_p++ = *script_p++;
if (script_p == scriptend_p)
break;
ASSERT(token_p != &token[MAXTOKEN]);
// Error ("Token too large on line %i\n",scriptline);
}
*token_p = 0;
}
/*
==============
=
= TokenAvailable
=
= Returns true if there is another token on the line
=
==============
*/
SWBOOL TokenAvailable(void)
{
char *search_p;
search_p = script_p;
if (search_p >= scriptend_p)
return FALSE;
while (*search_p <= 32)
{
if (*search_p == '\n')
return FALSE;
search_p++;
if (search_p == scriptend_p)
return FALSE;
}
if (*search_p == '#')
return FALSE;
return TRUE;
}
void DefaultExtension(char *path, char *extension)
{
char *src;
//
// if path doesn't have a .EXT, append extension
// (extension should include the .)
//
src = path + strlen(path) - 1;
while (*src != '\\' && src != path)
{
if (*src == '.')
return; // it has an extension
src--;
}
strcat(path, extension);
}
void DefaultPath(char *path, char *basepath)
{
char temp[128];
if (path[0] == '\\')
return; // absolute path location
strcpy(temp,path);
strcpy(path,basepath);
strcat(path,temp);
}
void StripFilename(char *path)
{
int length;
length = strlen(path)-1;
while (length > 0 && path[length] != PATHSEPERATOR)
length--;
path[length] = 0;
}
void ExtractFileBase(char *path, char *dest)
{
char *src;
int length;
src = path + strlen(path) - 1;
//
// back up until a \ or the start
//
while (src != path && *(src-1) != '\\')
src--;
//
// copy up to eight characters
//
memset(dest,0,8);
length = 0;
while (*src && *src != '.')
{
if (++length == 9)
Error("Filename base of %s >8 chars",path);
*dest++ = toupper(*src++);
}
}
/*
==============
=
= ParseNum / ParseHex
=
==============
*/
int ParseHex(char *hex)
{
char *str;
int num;
num = 0;
str = hex;
while (*str)
{
num <<= 4;
if (*str >= '0' && *str <= '9')
num += *str-'0';
else if (*str >= 'a' && *str <= 'f')
num += 10 + *str-'a';
else if (*str >= 'A' && *str <= 'F')
num += 10 + *str-'A';
else
Error("Bad hex number: %s",hex);
str++;
}
return num;
}
int ParseNum(char *str)
{
if (str[0] == '$')
return ParseHex(str+1);
if (str[0] == '0' && str[1] == 'x')
return ParseHex(str+2);
return atol(str);
}
// voxelarray format is:
// spritenumber, voxelnumber
int aVoxelArray[MAXTILES];
extern int nextvoxid;
// Load all the voxel files using swvoxfil.txt script file
// Script file format:
// # - Comment
// spritenumber (in artfile), voxel number, filename
// Ex. 1803 0 medkit2.kvx
// 1804 1 shotgun.kvx
// etc....
void LoadKVXFromScript(const char *filename)
{
int lNumber=0,lTile=0; // lNumber is the voxel no. and lTile is the editart tile being
// replaced.
char *sName; // KVS file being loaded in.
int grabbed=0; // Number of lines parsed
sName = (char *)malloc(256); // Up to 256 bytes for path
ASSERT(sName != NULL);
// zero out the array memory with -1's for pics not being voxelized
memset(aVoxelArray,-1,sizeof(aVoxelArray));
// Load the file
if (!LoadScriptFile(filename)) return;
do
{
GetToken(TRUE); // Crossing a line boundary on the end of line to first token
// of a new line is permitted (and expected)
if (endofscript)
break;
lTile = atol(token);
GetToken(FALSE);
lNumber = atol(token);
GetToken(FALSE);
strcpy(sName,token); // Copy the whole token as a file name and path
// Load the voxel file into memory
if (!qloadkvx(lNumber,sName))
{
// Store the sprite and voxel numbers for later use
aVoxelArray[lTile] = lNumber; // Voxel num
}
if (lNumber >= nextvoxid) // JBF: so voxels in the def file append to the list
nextvoxid = lNumber + 1;
grabbed++;
ASSERT(grabbed < MAXSPRITES);
}
while (script_p < scriptend_p);
free(scriptbuffer);
script_p = NULL;
}
/// MISC ////////////////////////////////////////////////////////////////////
/*
extern int idleclock,slackerclock;
// Watch dog function. Tracks user's work times.
void LogUserTime( SWBOOL bIsLoggingIn )
{
int size, readsize;
time_t time_of_day;
char serialid[20],filename[100],fbase[20],buf[26],filetemp[100];
FILE *fp;
int tothours, totmins, totsecs, gtotalclock=0,gidleclock=0;
ldiv_t mins_secs;
ldiv_t hrs_mins;
int i;
char path[] = "o:\\user\\jimn\\logs\\";
// char path[] = "c:\\jim\\sw\\";
memset(filename,0,sizeof(filename));
memset(fbase,0,sizeof(fbase));
memset(serialid,0,sizeof(serialid));
memset(buf,0,sizeof(buf));
memset(filetemp,0,sizeof(filetemp));
// Get the time of day user logged in to build
time_of_day = time( NULL );
// Get the serial number from the user's disk drive "it's unique!"
system("dir > serid.bld");
LoadScriptFile("serid.bld");
// Go to the serial number
for (i=0; i<11; i++)
{
GetToken (TRUE);
if (endofscript)
return;
}
// Copy the token to serialid
strcpy(serialid,token);
// Free the script memory when done
free(scriptbuffer);
script_p = NULL;
// Build a file name using serial id.
strcpy(filename,path);
strncpy(fbase,serialid,8);
strcat(fbase,".bld");
strcat(filename,fbase);
// Delete the temp file
system("erase serid.bld");
// Unhide the file so it can be opened
_dos_setfileattr(filename,_A_NORMAL);
// Open the file
fp = fopen( filename, "a+" );
// Opening on the network failed, try putting it on the current disk drive
if(fp == NULL)
{
// Unhide the file so it can be opened/this works if file was created before!
_dos_setfileattr(fbase,_A_NORMAL);
fp = fopen( fbase, "a+" );
strcpy(filetemp,fbase);
} else
strcpy(filetemp,filename);
if( fp == NULL)
return;
else
{
if(bIsLoggingIn)
{
fprintf(fp, "//////////////////////////////\n");
fprintf(fp, "User logged into build at: %s", _ctime( &time_of_day, buf ) );
}else
{
totsecs = totalclock/120; // Convert totalclock to seconds.
mins_secs = ldiv( totsecs, 60L );
totmins = mins_secs.quot;
totsecs = mins_secs.rem;
hrs_mins = ldiv( totmins, 60L);
tothours = hrs_mins.quot;
totmins = hrs_mins.rem;
fprintf(fp, "TotalClock: %ld\n",totalclock);
#ifdef COMPUTE_TOTALS
fprintf(fp, "IdleClock: %ld\n",slackerclock);
#endif
fprintf(fp, "Time this session: %ld Hours %ld Mins %ld Secs\n",tothours,totmins,totsecs);
#ifdef COMPUTE_TOTALS
totsecs = (totalclock-slackerclock)/120; // Convert totalclock to seconds.
if(totsecs<=0) totsecs = 0;
mins_secs = ldiv( totsecs, 60L );
totmins = mins_secs.quot;
totsecs = mins_secs.rem;
hrs_mins = ldiv( totmins, 60L);
tothours = hrs_mins.quot;
totmins = hrs_mins.rem;
fprintf(fp, "Time - idleclock : %ld Hours %ld Mins %ld Secs\n",tothours,totmins,totsecs);
#endif
}
fclose( fp );
}
#if 1
if(!bIsLoggingIn)
{
// Compute total time for file
LoadScriptFile(filetemp);
do {
GetToken (TRUE);
if (endofscript)
break;
if(!strcmpi(token,"totalclock:"))
{
GetToken(TRUE);
gtotalclock += atol(token);
}
#if 0
if(!strcmpi(token,"idleclock:"))
{
GetToken(TRUE);
gidleclock += atol(token);
}
#endif
} while (script_p < scriptend_p);
// Free the script memory when done
free(scriptbuffer);
script_p = NULL;
// Open the file
fp = fopen( filetemp, "a+" );
// Now compute the grand total
if(fp != NULL)
{
totsecs = gtotalclock/120; // Convert totalclock to seconds.
mins_secs = ldiv( totsecs, 60L );
totmins = mins_secs.quot;
totsecs = mins_secs.rem;
hrs_mins = ldiv( totmins, 60L);
tothours = hrs_mins.quot;
totmins = hrs_mins.rem;
fprintf(fp, "\nTotal time so far : %ld Hours %ld Mins %ld Secs\n",tothours,totmins,totsecs);
#if 0
totsecs = (gtotalclock-gidleclock)/120; // Convert totalclock to seconds.
if(totsecs<=0) totsecs = 0;
mins_secs = ldiv( totsecs, 60L );
totmins = mins_secs.quot;
totsecs = mins_secs.rem;
hrs_mins = ldiv( totmins, 60L);
tothours = hrs_mins.quot;
totmins = hrs_mins.rem;
fprintf(fp, "\nTotal actual time : %ld Hours %ld Mins %ld Secs\n",tothours,totmins,totsecs);
#endif
fclose(fp);
}
}
#endif
_dos_setfileattr(filename,_A_HIDDEN);
}
*/
END_SW_NS

View file

@ -1,736 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2005 - 3D Realms Entertainment
This file is NOT part of Shadow Warrior version 1.2
However, it is either an older version of a file that is, or is
some test code written during the development of Shadow Warrior.
This file is provided purely for educational interest.
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "build.h"
#include "editor.h"
#include "keys.h"
#include "names2.h"
#include "game.h"
BEGIN_SW_NS
extern int qsetmode;
SWBOOL FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum);
SWBOOL FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum);
short ViewSectorInScene(short cursectnum, short type, short level);
void Message(const char *string, char color);
void
_Assert(const char *expr, const char *strFile, unsigned uLine)
{
printf(ds, "Assertion failed: %s %s, line %u\n", expr, strFile, uLine);
//DSPRINTF(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine);
MONO_PRINT(ds);
exit(0);
}
////////////////////////////////////////////////////////////////////
//
// FLOOR ABOVE FLOOR
//
////////////////////////////////////////////////////////////////////
#define ZMAX 400
typedef struct
{
int32_t zval[ZMAX];
int16_t sectnum[ZMAX];
int16_t pic[ZMAX];
int16_t slope[ZMAX];
int16_t zcount;
} SAVE, *SAVEp;
SAVE save;
SWBOOL FAF_DebugView = 0;
SWBOOL FAFon = 0;
SWBOOL FAF_DontMoveSectors = FALSE;
short bak_searchsector, bak_searchwall, bak_searchstat;
extern short searchsector, searchwall, searchstat, searchit;
void SetupBuildFAF(void);
void ResetBuildFAF(void);
void ToggleFAF(void)
{
if (keystatus[KEYSC_3])
{
keystatus[KEYSC_3] = FALSE;
FLIP(FAFon, 1);
if (FAFon)
{
SetupBuildFAF();
}
else
{
ResetBuildFAF();
}
}
if (FAFon && qsetmode == 200)
{
DrawOverlapRoom(pos.x, pos.y, pos.z, ang, horiz, cursectnum);
// make it so that you can edit both areas in 3D
// back up vars after the first drawrooms
bak_searchsector = searchsector;
bak_searchwall = searchwall;
bak_searchstat = searchstat;
searchit = 2;
}
if (FAFon && qsetmode == 200 && keystatus[KEYSC_4])
{
short match;
int tx,ty,tz;
short tsectnum;
short i;
keystatus[KEYSC_4] = FALSE;
tx = pos.x;
ty = pos.y;
tz = pos.z;
tsectnum = cursectnum;
save.zcount = 0;
if (sector[cursectnum].ceilingpicnum == FAF_MIRROR_PIC)
{
match = ViewSectorInScene(tsectnum, VIEW_THRU_CEILING, VIEW_LEVEL1);
FAF_DontMoveSectors = TRUE;
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
FAF_DontMoveSectors = FALSE;
pos.x = tx;
pos.y = ty;
cursectnum = tsectnum;
pos.z = sector[cursectnum].floorz - Z(20);
}
else if (sector[cursectnum].floorpicnum == FAF_MIRROR_PIC)
{
match = ViewSectorInScene(tsectnum, VIEW_THRU_FLOOR, VIEW_LEVEL2);
FAF_DontMoveSectors = TRUE;
FindFloorView(match, &tx, &ty, tz, &tsectnum);
FAF_DontMoveSectors = FALSE;
pos.x = tx;
pos.y = ty;
cursectnum = tsectnum;
pos.z = sector[cursectnum].ceilingz + Z(20);
}
}
}
void FAF_AfterDrawRooms(void)
{
// make it so that you can edit both areas in 3D
// if your cursor is in the FAF_MIRROR_PIC area use the vars from the first
// drawrooms instead
if ((searchstat == 1 && sector[searchsector].ceilingpicnum == FAF_MIRROR_PIC) ||
(searchstat == 2 && sector[searchsector].floorpicnum == FAF_MIRROR_PIC))
{
searchsector = bak_searchsector;
searchwall = bak_searchwall;
searchstat = bak_searchstat;
}
}
void
SetupBuildFAF(void)
{
short i, nexti;
SPRITEp sp,vc_sp,vf_sp,vl_sp;
short SpriteNum, NextSprite;
short vc,nextvc,vf,nextvf,l,nextl;
int zdiff;
// move every sprite to the correct list
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], SpriteNum, NextSprite)
{
sp = &sprite[SpriteNum];
if (sp->picnum != ST1)
continue;
switch (sp->hitag)
{
case VIEW_THRU_CEILING:
case VIEW_THRU_FLOOR:
{
int i,nexti;
// make sure there is only one set per level of these
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
if (sprite[i].hitag == sp->hitag && sprite[i].lotag == sp->lotag)
{
sprintf(ds,"Two VIEW_THRU_ tags with same match found on level\n1: x %d, y %d \n2: x %d, y %d", TrackerCast(sp->x), TrackerCast(sp->y), TrackerCast(sprite[i].x), TrackerCast(sprite[i].y));
Message(ds,0);
}
}
changespritestat(SpriteNum, STAT_FAF);
break;
}
case VIEW_LEVEL1:
case VIEW_LEVEL2:
case VIEW_LEVEL3:
case VIEW_LEVEL4:
case VIEW_LEVEL5:
case VIEW_LEVEL6:
{
changespritestat(SpriteNum, STAT_FAF);
break;
}
}
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sector[sp->sectnum].ceilingpicnum == FAF_PLACE_MIRROR_PIC)
{
sector[sp->sectnum].ceilingpicnum = FAF_MIRROR_PIC;
if (sector[sp->sectnum].floorz == sector[sp->sectnum].ceilingz)
{
sprintf(ds, "Mirror used for non-connect area. Use tile 342. Sect %d, x %d, y %d\n", TrackerCast(sp->sectnum), TrackerCast(wall[sector[sp->sectnum].wallptr].x), TrackerCast(wall[sector[sp->sectnum].wallptr].y));
Message(ds,0);
}
}
if (sector[sp->sectnum].floorpicnum == FAF_PLACE_MIRROR_PIC)
{
sector[sp->sectnum].floorpicnum = FAF_MIRROR_PIC;
if (sector[sp->sectnum].floorz == sector[sp->sectnum].ceilingz)
{
sprintf(ds, "Mirror used for non-connect area. Use tile 342. Sect %d, x %d, y %d\n", TrackerCast(sp->sectnum), TrackerCast(wall[sector[sp->sectnum].wallptr].x), TrackerCast(wall[sector[sp->sectnum].wallptr].y));
Message(ds,0);
}
}
if (sector[sp->sectnum].ceilingpicnum == FAF_PLACE_MIRROR_PIC+1)
sector[sp->sectnum].ceilingpicnum = FAF_MIRROR_PIC+1;
if (sector[sp->sectnum].floorpicnum == FAF_PLACE_MIRROR_PIC+1)
sector[sp->sectnum].floorpicnum = FAF_MIRROR_PIC+1;
}
for (i = 0; i < numwalls; i++)
{
if (wall[i].picnum == FAF_PLACE_MIRROR_PIC)
wall[i].picnum = FAF_MIRROR_PIC;
if (wall[i].picnum == FAF_PLACE_MIRROR_PIC+1)
wall[i].picnum = FAF_MIRROR_PIC+1;
}
#if 0
// check ceiling and floor heights
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], vc, nextvc)
{
vc_sp = &sprite[vc];
if (vc_sp->hitag == VIEW_THRU_CEILING)
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], vf, nextvf)
{
vf_sp = &sprite[vf];
if (vf_sp->hitag == VIEW_THRU_FLOOR && vf_sp->lotag == vc_sp->lotag)
{
zdiff = labs(sector[vc_sp->sectnum].ceilingz - sector[vf_sp->sectnum].floorz);
//DSPRINTF(ds,"zdiff %d",zdiff);
MONO_PRINT(ds);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], l, nextl)
{
vl_sp = &sprite[l];
if (vl_sp->hitag == VIEW_LEVEL1)
{
if (sector[vl_sp->sectnum].ceilingz < sector[vc_sp->sectnum].ceilingz + zdiff)
{
sprintf(ds,"Sector %d (x %d, y %d) ceiling z to close to VIEW_THRU_CEILING z",
vl_sp->sectnum, wall[sector[vl_sp->sectnum].wallptr].x, wall[sector[vl_sp->sectnum].wallptr].y);
Message(ds,0);
}
}
else if (vl_sp->hitag == VIEW_LEVEL2)
{
if (sector[vl_sp->sectnum].floorz > sector[vf_sp->sectnum].floorz + zdiff)
{
sprintf(ds,"Sector %d (x %d, y %d)floor z to close to VIEW_THRU_FLOOR z",
vl_sp->sectnum, wall[sector[vl_sp->sectnum].wallptr].x, wall[sector[vl_sp->sectnum].wallptr].y);
Message(ds,0);
}
}
}
}
}
}
}
#endif
}
void
ResetBuildFAF(void)
{
short i, nexti;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sector[sp->sectnum].ceilingpicnum == FAF_MIRROR_PIC)
sector[sp->sectnum].ceilingpicnum = FAF_PLACE_MIRROR_PIC;
if (sector[sp->sectnum].floorpicnum == FAF_MIRROR_PIC)
sector[sp->sectnum].floorpicnum = FAF_PLACE_MIRROR_PIC;
if (sector[sp->sectnum].ceilingpicnum == FAF_MIRROR_PIC+1)
sector[sp->sectnum].ceilingpicnum = FAF_PLACE_MIRROR_PIC+1;
if (sector[sp->sectnum].floorpicnum == FAF_MIRROR_PIC+1)
sector[sp->sectnum].floorpicnum = FAF_PLACE_MIRROR_PIC+1;
}
for (i = 0; i < numwalls; i++)
{
if (wall[i].picnum == FAF_MIRROR_PIC)
wall[i].picnum = FAF_PLACE_MIRROR_PIC;
if (wall[i].picnum == FAF_MIRROR_PIC+1)
wall[i].picnum = FAF_PLACE_MIRROR_PIC+1;
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
changespritestat(i, STAT_DEFAULT);
}
}
SWBOOL
PicInView(short tile_num, SWBOOL reset)
{
if (TEST(gotpic[tile_num >> 3], 1 << (tile_num & 7)))
{
if (reset)
RESET(gotpic[tile_num >> 3], 1 << (tile_num & 7));
return TRUE;
}
return FALSE;
}
void
GetUpperLowerSector(short match, int x, int y, short *upper, short *lower)
{
int i, j;
short sectorlist[16];
short sln = 0;
short SpriteNum, Next;
SPRITEp sp;
// didn't find it yet so test ALL sectors
if (sln < 2)
{
sln = 0;
for (i = numsectors - 1; i >= 0; i--)
{
if (inside(x, y, (short) i) == 1)
{
SWBOOL found = FALSE;
TRAVERSE_SPRITE_SECT(headspritesect[i], SpriteNum, Next)
{
sp = &sprite[SpriteNum];
if (sp->statnum == STAT_FAF &&
(sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)
&& sp->lotag == match)
{
found = TRUE;
}
}
if (!found)
continue;
sectorlist[sln] = i;
sln++;
}
}
}
if (sln == 0)
{
*upper = -1;
*lower = -1;
return;
}
// Map rooms have NOT been dragged on top of each other
if (sln == 1)
{
*lower = sectorlist[0];
*upper = sectorlist[0];
return;
}
else
// Map rooms HAVE been dragged on top of each other
if (sln > 2)
{
// try again moving the x,y pos around until you only get two sectors
GetUpperLowerSector(match, x - 1, y, upper, lower);
}
if (sln == 2)
{
if (sector[sectorlist[0]].floorz < sector[sectorlist[1]].floorz)
{
// swap
// make sectorlist[0] the LOW sector
short hold;
hold = sectorlist[0];
sectorlist[0] = sectorlist[1];
sectorlist[1] = hold;
}
*lower = sectorlist[0];
*upper = sectorlist[1];
}
}
SWBOOL
FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum)
{
int xoff = 0;
int yoff = 0;
short i, nexti;
SPRITEp sp = NULL;
short top_sprite = -1;
int pix_diff;
int newz;
save.zcount = 0;
// Search Stat List For closest ceiling view sprite
// Get the match, xoff, yoff from this point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->hitag == VIEW_THRU_CEILING && sp->lotag == match)
{
xoff = *x - sp->x;
yoff = *y - sp->y;
break;
}
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->lotag == match)
{
// determine x,y position
if (sp->hitag == VIEW_THRU_FLOOR)
{
short upper, lower;
*x = sp->x + xoff;
*y = sp->y + yoff;
// get new sector
GetUpperLowerSector(match, *x, *y, &upper, &lower);
*sectnum = upper;
break;
}
}
}
if (*sectnum < 0)
return FALSE;
ASSERT(sp);
ASSERT(sp->hitag == VIEW_THRU_FLOOR);
if (FAF_DontMoveSectors)
return TRUE;
pix_diff = labs(z - sector[sp->sectnum].floorz) >> 8;
newz = sector[sp->sectnum].floorz + ((pix_diff / 128) + 1) * Z(128);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->lotag == match)
{
// move lower levels ceilings up for the correct view
if (sp->hitag == VIEW_LEVEL2)
{
// save it off
save.sectnum[save.zcount] = sp->sectnum;
save.zval[save.zcount] = sector[sp->sectnum].floorz;
save.pic[save.zcount] = sector[sp->sectnum].floorpicnum;
save.slope[save.zcount] = sector[sp->sectnum].floorheinum;
sector[sp->sectnum].floorz = newz;
sector[sp->sectnum].floorpicnum = FAF_MIRROR_PIC+1;
sector[sp->sectnum].floorheinum = 0;
save.zcount++;
ASSERT(save.zcount < ZMAX);
}
}
}
return TRUE;
}
SWBOOL
FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum)
{
int xoff = 0;
int yoff = 0;
short i, nexti;
SPRITEp sp = NULL;
int newz;
int pix_diff;
save.zcount = 0;
// Search Stat List For closest ceiling view sprite
// Get the match, xoff, yoff from this point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->hitag == VIEW_THRU_FLOOR && sp->lotag == match)
{
xoff = *x - sp->x;
yoff = *y - sp->y;
break;
}
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->lotag == match)
{
// determine x,y position
if (sp->hitag == VIEW_THRU_CEILING)
{
short upper, lower;
*x = sp->x + xoff;
*y = sp->y + yoff;
// get new sector
GetUpperLowerSector(match, *x, *y, &upper, &lower);
*sectnum = lower;
break;
}
}
}
if (*sectnum < 0)
return FALSE;
ASSERT(sp);
ASSERT(sp->hitag == VIEW_THRU_CEILING);
if (FAF_DontMoveSectors)
return TRUE;
// move ceiling multiple of 128 so that the wall tile will line up
pix_diff = labs(z - sector[sp->sectnum].ceilingz) >> 8;
newz = sector[sp->sectnum].ceilingz - ((pix_diff / 128) + 1) * Z(128);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->lotag == match)
{
// move upper levels floors down for the correct view
if (sp->hitag == VIEW_LEVEL1)
{
// save it off
save.sectnum[save.zcount] = sp->sectnum;
save.zval[save.zcount] = sector[sp->sectnum].ceilingz;
save.pic[save.zcount] = sector[sp->sectnum].ceilingpicnum;
save.slope[save.zcount] = sector[sp->sectnum].ceilingheinum;
sector[sp->sectnum].ceilingz = newz;
sector[sp->sectnum].ceilingpicnum = FAF_MIRROR_PIC+1;
sector[sp->sectnum].ceilingheinum = 0;
save.zcount++;
ASSERT(save.zcount < ZMAX);
}
}
}
return TRUE;
}
SWBOOL
SectorInScene(short tile_num)
{
if (TEST(gotsector[tile_num >> 3], 1 << (tile_num & 7)))
{
RESET(gotsector[tile_num >> 3], 1 << (tile_num & 7));
return TRUE;
}
return FALSE;
}
short
ViewSectorInScene(short cursectnum, short type, short level)
{
int i, nexti;
int j, nextj;
SPRITEp sp;
SPRITEp sp2;
int cz, fz;
short match;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FAF], i, nexti)
{
sp = &sprite[i];
if (sp->hitag == level)
{
if (cursectnum == sp->sectnum)
{
// ignore case if sprite is pointing up
if (sp->ang == 1536)
continue;
// only gets to here is sprite is pointing down
// found a potential match
match = sp->lotag;
return match;
}
}
}
return -1;
}
void
DrawOverlapRoom(int tx, int ty, int tz, short tang, int thoriz, short tsectnum)
{
short i;
short match;
save.zcount = 0;
match = ViewSectorInScene(tsectnum, VIEW_THRU_CEILING, VIEW_LEVEL1);
if (match != -1)
{
FindCeilingView(match, &tx, &ty, tz, &tsectnum);
if (tsectnum < 0)
{
sprintf(ds,"COULD NOT FIND TAGGED LEVEL2 SECTOR FROM X %d, Y %d, SECTNUM %d.",pos.x,pos.y,cursectnum);
Message(ds, 0);
return;
}
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
renderDrawMasks();
// reset Z's
for (i = 0; i < save.zcount; i++)
{
sector[save.sectnum[i]].floorz = save.zval[i];
sector[save.sectnum[i]].floorpicnum = save.pic[i];
sector[save.sectnum[i]].floorheinum = save.slope[i];
}
}
else
{
match = ViewSectorInScene(tsectnum, VIEW_THRU_FLOOR, VIEW_LEVEL2);
if (match != -1)
{
FindFloorView(match, &tx, &ty, tz, &tsectnum);
if (tsectnum < 0)
{
sprintf(ds,"COULD NOT FIND TAGGED LEVEL1 SECTOR FROM X %d, Y %d, SECTNUM %d.",pos.x,pos.y,cursectnum);
Message(ds, 0);
return;
}
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
renderDrawMasks();
// reset Z's
for (i = 0; i < save.zcount; i++)
{
sector[save.sectnum[i]].ceilingz = save.zval[i];
sector[save.sectnum[i]].ceilingpicnum = save.pic[i];
sector[save.sectnum[i]].ceilingheinum = save.slope[i];
}
}
}
}
END_SW_NS

View file

@ -30,7 +30,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "keys.h"
#include "names2.h"
#include "panel.h"
#include "game.h"
#include "tags.h"
#include "ai.h"
#include "pal.h"

View file

@ -603,7 +603,7 @@ int32_t CONFIG_ReadSetup(void)
SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
//SCRIPT_GetNumber(scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "FXDevice",&FXDevice);
SCRIPT_GetNumber(scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
@ -670,7 +670,7 @@ void CONFIG_WriteSetup(void)
#endif
SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,FALSE,FALSE);
//SCRIPT_PutNumber(scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "FXDevice", FXDevice, FALSE, FALSE);
SCRIPT_PutNumber(scripthandle, "Sound Setup", "MusicDevice", MusicDevice, FALSE, FALSE);

View file

@ -30,7 +30,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "keys.h"
#include "names2.h"
#include "panel.h"
#include "game.h"
#include "tags.h"
#include "ai.h"
#include "sprite.h"
@ -567,9 +566,9 @@ SetupCoolie(short SpriteNum)
}
int NewCoolg(short);
int SpawnCoolg(short SpriteNum)
{
int NewCoolg(short);
USERp u = User[SpriteNum];
// Don't do a ghost every time

View file

@ -23,7 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
BEGIN_SW_NS
#ifdef DAMAGE_TABLE
#define DAMAGE_ENTRY(id, init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon) \
@ -107,4 +106,3 @@ DAMAGE_ENTRY(MAX_WEAPONS, NULL, 10, 20, 0, -1, -1, -
#undef DAMAGE_ENTRY
#undef DAMAGE_ENTRY_WPN
END_SW_NS

View file

@ -23,7 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
BEGIN_SW_NS
#ifdef DIGI_TABLE
#define DIGI_ENTRY(name, id, id_num, pri, pitch_lo, pitch_hi, voc_num, voc_dist, voc_flags) { name, NULL, 0, pitch_lo, pitch_hi, pri, voc_num, voc_dist, voc_flags, 0,0},
@ -991,4 +990,3 @@ DIGI_ENTRY("ZC9.VOC", DIGI_ZC9, 624, PRI_PLAYERVOICE, 0,
DIGI_ENTRY("Z16043.VOC", DIGI_Z16043, 625, PRI_PLAYERVOICE, 0, 0, 0, DIST_NORMAL, VF_NORMAL)
#undef DIGI_ENTRY
END_SW_NS

View file

@ -2243,6 +2243,9 @@ void FAF_DrawRooms(int x, int y, int z, short ang, int horiz, short sectnum)
short ScreenSavePic = FALSE;
SWBOOL PicInView(short, SWBOOL);
void DoPlayerDiveMeter(PLAYERp pp);
void
drawscreen(PLAYERp pp)
{
@ -2255,10 +2258,8 @@ drawscreen(PLAYERp pp)
int bob_amt = 0;
int quake_z, quake_x, quake_y;
short quake_ang;
SWBOOL PicInView(short, SWBOOL);
extern SWBOOL FAF_DebugView;
PLAYERp camerapp; // prediction player if prediction is on, else regular player
void DoPlayerDiveMeter(PLAYERp pp);
// last valid stuff
static short lv_sectnum = -1;

View file

@ -93,10 +93,18 @@ Things required to make savegames work:
#include "common.h"
#include "common_game.h"
#include "crc32.h"
//#include "crc32.h"
BEGIN_SW_NS
void pClearSpriteList(PLAYERp pp);
signed char MNU_InputSmallString(char*, short);
signed char MNU_InputString(char*, short);
SWBOOL IsCommand(char* str);
SWBOOL MNU_StartNetGame(void);
const char* G_DefFile(void);
const char* AppProperName = "VoidSW";
const char* AppTechnicalName = "voidsw";
@ -673,7 +681,7 @@ TerminateGame(void)
ErrorCorrectionQuit();
uninitmultiplayers();
// uninitmultiplayers();
if (CleanExit)
{
@ -809,7 +817,7 @@ void Set_GameMode(void)
result = COVERsetgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP);
if (result < 0)
{
uninitmultiplayers();
//uninitmultiplayers();
//uninitkeys();
KB_Shutdown();
engineUnInit();
@ -836,7 +844,7 @@ void MultiSharewareCheck(void)
"\n\nTo play a Network game with more than 4 players you must purchase the\n"
"full version. Read the Ordering Info screens for details.\n\n");
#endif
uninitmultiplayers();
//uninitmultiplayers();
//uninitkeys();
KB_Shutdown();
engineUnInit();
@ -945,6 +953,7 @@ InitGame(int32_t argc, char const * const * argv)
InitPalette();
// sets numplayers, connecthead, connectpoint2, myconnectindex
#if 0
if (!firstnet)
initmultiplayers(0, NULL, 0, 0, 0);
else if (initmultiplayersparms(argc - firstnet, &argv[firstnet]))
@ -960,6 +969,7 @@ InitGame(int32_t argc, char const * const * argv)
}
}
}
#endif
initsynccrc();
// code to duplicate packets
@ -1478,7 +1488,6 @@ InitLevel(void)
void
TerminateLevel(void)
{
void pClearSpriteList(PLAYERp pp);
int i, nexti, stat, pnum, ndx;
SECT_USERp *sectu;
@ -2100,10 +2109,8 @@ IntroAnimLevel(void)
void
MenuLevel(void)
{
SWBOOL MNU_StartNetGame(void);
char called;
int fin;
extern ClockTicks totalclocklock;
short w,h;
DSPRINTF(ds,"MenuLevel...");
@ -4717,14 +4724,11 @@ void GetMessageInput(PLAYERp pp)
{
int pnum = myconnectindex;
short w,h;
signed char MNU_InputSmallString(char *, short);
signed char MNU_InputString(char *, short);
static SWBOOL cur_show;
static SWBOOL TeamSendAll, TeamSendTeam;
#define TEAM_MENU "A - Send to ALL, T - Send to TEAM"
static char HoldMessageInputString[256];
int i;
SWBOOL IsCommand(char *str);
if (!MessageInputMode && !ConInputMode)
{
@ -4870,8 +4874,6 @@ void GetConInput(PLAYERp pp)
{
int pnum = myconnectindex;
short w,h;
signed char MNU_InputSmallString(char *, short);
signed char MNU_InputString(char *, short);
static SWBOOL cur_show;
if (MessageInputMode || HelpInputMode)

View file

@ -32,6 +32,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define DEBUG 0
#endif
#ifdef _MSC_VER
#pragma warning(disable:4101) // there's too many of these... :(
#endif
#include "compat.h"
#include "baselayer.h"
#include "mmulti.h"
@ -40,6 +44,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "keyboard.h"
#include "sounds.h"
#include "settings.h"
#include "pragmas.h"
BEGIN_SW_NS
@ -120,7 +125,6 @@ int krand1(void);
#define PRINT(line,str) DebugPrint(line,str)
#include "pragmas.h"
//
@ -2114,7 +2118,7 @@ SWBOOL FAF_ConnectFloor(short sectnum);
#define FAF_ConnectFloor(sectnum) (sector[(sectnum)].floorpicnum == FAF_MIRROR_PIC)
#define FAF_ConnectArea(sectnum) (FAF_ConnectCeiling(sectnum) || FAF_ConnectFloor(sectnum))
#endif
void updatesectorz(int, int, int, short *);
//void updatesectorz(int, int, int, short *);
void FAF_ConnectPlayerCeiling(PLAYERp pp);
void FAF_ConnectPlayerFloor(PLAYERp pp);
SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit);
@ -2137,8 +2141,6 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector);
void updatesectorz(int,int,int,int16_t*);
void short_setinterpolation(short *posptr);
void short_stopinterpolation(short *posptr);
@ -2275,7 +2277,6 @@ extern void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor);
extern void DoPaletteFlash(PLAYERp pp);
extern unsigned char palette_data[256][3];
extern SWBOOL NightVision;
#endif
int _PlayerSound(const char *file, int line, int num, int *x, int *y, int *z, Voc3D_Flags flags, PLAYERp pp);
#define PlayerSound(num, x, y, z, flags, pp) _PlayerSound(__FILE__, __LINE__, (num), (x), (y), (z), (flags), (pp))
@ -2388,3 +2389,5 @@ int COVERinsertsprite(short sectnum, short statnum); //returns (short)spritenu
void AudioUpdate(void); // stupid
END_SW_NS
#endif

View file

@ -34,7 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#ifndef gamedefs_public_
#define gamedefs_public_
BEGIN_SW_NS
//****************************************************************************
//
@ -213,6 +212,5 @@ enum
};
END_SW_NS
#endif

View file

@ -28,7 +28,7 @@
#include "scriptfile.h"
#include "cache1d.h"
#include "crc32.h"
#include "crc32_.h"
#include "grpscan.h"

View file

@ -23,7 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
BEGIN_SW_NS
enum InventoryNames
{
@ -60,4 +59,3 @@ void UpdateMiniBar(PLAYERp pp);
void InventoryKeys(PLAYERp pp);
void UseInventoryRepairKit(PLAYERp pp);
void InventoryTimer(PLAYERp pp);
END_SW_NS

View file

@ -1,225 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2005 - 3D Realms Entertainment
This file is NOT part of Shadow Warrior version 1.2
However, it is either an older version of a file that is, or is
some test code written during the development of Shadow Warrior.
This file is provided purely for educational interest.
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include "build.h"
#include "editor.h"
#include "cache1d.h"
#include "keys.h"
#include "names2.h"
#include "game.h"
BEGIN_SW_NS
#define M_RED 12
#define M_BLUE 9
// Globals
static char tempbuf[256];
// Prototypes
void Message(const char *string, char color);
long GetAToken(char *name, char *tc, long length);
uint8_t* BKeyPressed(void);
void ResetKeys(void);
// Functions
void Msg(const char *string, char color)
{
clearmidstatbar16();
printext16(1*4,ydim16+4*8,color,-1,string,1);
}
// @ symbol precedes a tag name target
// # symbol precedes a comment in the help file
long GetAToken(char *name, char *tc, long length)
{
int i,x=0;
char t,*tmp,tokenfound=0;
char token[10];
long count=0;
do
{
// Find the token symbol
do
{
t = *tc;
tc++;
count++;
}
while (t!='@' && count < length);
if (t=='@')
{
tmp = token;
x=1;
do
{
// Read in the token
*tmp = t;
tmp++;
t = *tc;
tc++;
x++;
count++;
}
while (t>=48 && t!='@' && x < 9 && count < length);
*tmp = 0;
if (!strcmp(name,Bstrupr(token)))
tokenfound = 1;
}
}
while (!tokenfound && count < length);
if (!tokenfound) count=0;
return count;
}
void ContextHelp(short spritenum)
{
int i,fp,x=0,y=4;
char t,*tc;
char name[20];
char *filebuffer;
SPRITEp sp;
short hitag=0;
long size=0,tokresult=0;
sp = &sprite[spritenum];
clearmidstatbar16();
if ((fp=kopen4load("swbhelp.hlp",0)) == -1)
{
Msg("ERROR: Help file not found.",M_RED);
return;
}
// Read in whole file
size = kfilelength(fp);
filebuffer = (char *)malloc(size);
if (filebuffer == NULL)
{
Msg("Not enough memory to load swhelp.hlp",M_RED);
return;
}
if (kread(fp, filebuffer, size) != size)
{
Msg("Unexpected end of file while reading swhelp.hlp",M_RED);
kclose(fp);
return;
}
// close the file
kclose(fp);
// Conver filebuffer to all upper case
//strupr(filebuffer);
// Assign a token name to search for based on the sprite being pointed to.
// Make the token
// Make sure 500-600 SOBJ bounding tags all say the same thing.
hitag = sp->hitag;
if (hitag > 500 && hitag <= 600) hitag = 500;
// Give help summary for unknown sprites.
if ((hitag == 0 || hitag > 1006) && sp->lotag == 0) hitag = 999;
sprintf(name,"@TAG%d",hitag);
tc = filebuffer;
if (!(tokresult = GetAToken(name,tc,size)))
{
// This message should never happen unless something is real wrong!
Msg("No help available.",M_RED);
return;
}
tc += tokresult;
do
{
tc++;
t = *tc;
while (t!='\n' && t!='@' && t!='#' && x<128)
{
tempbuf[x]=t;
tc++;
t = *tc;
x++;
if (x >= 128) break;
}
tempbuf[x]=0;
x=0;
printext16(x*4,ydim16+(y*6)+2,11,-1,tempbuf,1);
y++;
if (y>16)
{
y=18;
printext16(x*4,ydim16+(y*6)+2,11,-1,"Hit any key to continue or Q to quit....",1);
while (BKeyPressed() == NULL) ;
if (keystatus[KEYSC_Q])
{
clearmidstatbar16();
return;
}
ResetKeys();
clearmidstatbar16();
y=6;
}
}
while (t!='@' && t!='#');
}
END_SW_NS

View file

@ -168,6 +168,8 @@ CheckTileSound(short picnum)
return sndnum;
}
ANIMATOR GenerateDrips;
/////////////////////////////////////////////////////
// Initialize any of my special use sprites
/////////////////////////////////////////////////////
@ -225,8 +227,6 @@ JS_SpriteSetup(void)
}
else if (tag == TAG_DRIPGEN)
{
ANIMATOR GenerateDrips;
u = SpawnUser(SpriteNum, 0, NULL);
ASSERT(u != NULL);

View file

@ -57,6 +57,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
signed char MNU_InputString(char*, short);
//#define PLOCK_VERSION TRUE
@ -612,7 +614,6 @@ SWBOOL
MNU_DoParentalPassword(UserCall call, MenuItem_p item)
{
short w,h;
signed char MNU_InputString(char *, short);
static SWBOOL cur_show;
char TempString[80];
const char *extra_text;

View file

@ -31,9 +31,10 @@ BEGIN_SW_NS
typedef BFILE* MFILE_WRITE;
typedef int32_t MFILE_READ;
#define MREAD(ptr, size, num,handle) kdfread((ptr),(size),(num),(handle))
#define MWRITE(ptr, size, num,handle) dfwrite((ptr),(size),(num),(handle))
#define MOPEN_WRITE(name) Bfopen(name,"wb")
#define MREAD(ptr, size, num,handle) kread((handle),(ptr), (size) * (num))
#define MWRITE(ptr, size, num,handle) fwrite((ptr),(size),(num),(handle))
#define MOPEN_WRITE(name) fopen(name,"wb")
#define MOPEN_READ(name) kopen4load(name,0)
#define MCLOSE_WRITE(handle) Bfclose(handle)
#define MCLOSE_READ(handle) kclose(handle)

View file

@ -30,7 +30,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "compat.h"
BEGIN_SW_NS
#define OFF 0
#define ON (!OFF)
@ -155,7 +154,6 @@ typedef unsigned char SWBOOL;
#define BETWEEN(x,low,high) (((x) >= (low)) && ((x) <= (high)))
END_SW_NS
#endif

View file

@ -29,7 +29,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "names.h"
BEGIN_SW_NS
// Rotation info
@ -1248,6 +1247,5 @@ enum STAT_ENUMS
#define SCROLL 516
#define SCROLL_FIRE 524
END_SW_NS
#endif

View file

@ -43,6 +43,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
void getinput(SW_PACKET*);
/*
SYNC BUG NOTES:
@ -153,11 +155,11 @@ void netsendpacket(int ind, uint8_t* buf, int len)
memcpy(&prx[1], buf, len); // &prx[1] == (char*)prx + sizeof(PACKET_PROXY)
len += sizeof(PACKET_PROXY);
sendpacket(connecthead, bbuf, len);
//sendpacket(connecthead, bbuf, len);
return;
}
sendpacket(ind, buf, len);
//sendpacket(ind, buf, len);
buildprintf("netsendpacket() sends normal to %d\nContents:",ind);
for (i=0; i<len; i++)
@ -190,14 +192,14 @@ void netbroadcastpacket(uint8_t* buf, int len)
memcpy(&prx[1], buf, len);
len += sizeof(PACKET_PROXY);
sendpacket(connecthead, bbuf, len);
//sendpacket(connecthead, bbuf, len);
return;
}
for (i = connecthead; i >= 0; i = connectpoint2[i])
{
if (i == myconnectindex) continue;
sendpacket(i, buf, len);
//sendpacket(i, buf, len);
buildprintf("netsendpacket() sends normal to %d\n",i);
}
buildputs("Contents:");
@ -212,7 +214,7 @@ int netgetpacket(int *ind, uint8_t* buf)
int len;
PACKET_PROXYp prx;
len = getpacket(ind, buf);
len = 0;// getpacket(ind, buf);
if ((unsigned)len < sizeof(PACKET_PROXY) || buf[0] != PACKET_TYPE_PROXY)
{
if (len > 0)
@ -248,7 +250,7 @@ int netgetpacket(int *ind, uint8_t* buf)
{
if (i == myconnectindex || i == *ind) continue;
buildprintf("netgetpacket(): distributing to %d\n", i);
sendpacket(i, buf, len);
//sendpacket(i, buf, len);
}
// Return the packet payload to the caller
@ -274,7 +276,7 @@ int netgetpacket(int *ind, uint8_t* buf)
}
buildprintf("netgetpacket(): forwarding to %d\n", i);
sendpacket(i, buf, len);
//sendpacket(i, buf, len);
return 0; // nothing for us to do
}
}
@ -941,7 +943,6 @@ faketimerhandler(void)
int i, j, k, l;
PLAYERp pp;
short pnum;
void getinput(SW_PACKET *);
extern SWBOOL BotMode;
#if 0

View file

@ -44,6 +44,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
/*
!AIC - Decision tables used in mostly ai.c DoActorActionDecide().
@ -1921,7 +1923,6 @@ DoNinjaHariKari(short SpriteNum)
{
USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP;
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
short cnt,i;
UpdateSinglePlayKills(SpriteNum);
@ -1952,7 +1953,6 @@ DoNinjaGrabThroat(short SpriteNum)
{
USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP;
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
short cnt,i;
if ((u->WaitTics -= ACTORMOVETICS) <= 0)

View file

@ -47,6 +47,23 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
int InitSwordAttack(PLAYERp pp);
PANEL_SPRITEp InitWeaponUziSecondaryReload(PANEL_SPRITEp);
PANEL_SPRITEp InitWeaponUzi2(PANEL_SPRITEp);
int InitShotgun(PLAYERp pp);
int InitRail(PLAYERp pp);
int InitEMP(PLAYERp pp);
int InitMicro(PLAYERp pp);
int InitRocket(PLAYERp pp);
int InitNuke(PLAYERp pp);
int InitGrenade(PLAYERp pp);
int InitMine(PLAYERp pp);
int InitFistAttack(PLAYERp pp);
//#define UK_VERSION TRUE
#define PANF_UZI_XFLIP (BIT(21))
@ -1628,7 +1645,6 @@ pSwordAction(PANEL_SPRITEp psp)
void
pSwordAttack(PANEL_SPRITEp psp)
{
int InitSwordAttack(PLAYERp pp);
InitSwordAttack(psp->PlayerP);
}
@ -2336,7 +2352,6 @@ pUziReloadRetract(PANEL_SPRITEp nclip)
void
pUziDoneReload(PANEL_SPRITEp psp)
{
PANEL_SPRITEp InitWeaponUziSecondaryReload(PANEL_SPRITEp);
PLAYERp pp = psp->PlayerP;
@ -2438,7 +2453,6 @@ pUziClip(PANEL_SPRITEp oclip)
void
InitWeaponUzi(PLAYERp pp)
{
PANEL_SPRITEp InitWeaponUzi2(PANEL_SPRITEp);
PANEL_SPRITEp psp = NULL;
if (Prediction)
@ -3540,8 +3554,6 @@ pShotgunAction(PANEL_SPRITEp psp)
void
pShotgunFire(PANEL_SPRITEp psp)
{
int InitShotgun(PLAYERp pp);
SpawnVis(psp->PlayerP->PlayerSprite, -1, -1, -1, -1, 32);
InitShotgun(psp->PlayerP);
//SpawnShotgunShell(psp);
@ -3940,9 +3952,6 @@ pRailAction(PANEL_SPRITEp psp)
void
pRailFire(PANEL_SPRITEp psp)
{
int InitRail(PLAYERp pp);
int InitEMP(PLAYERp pp);
SpawnVis(psp->PlayerP->PlayerSprite, -1, -1, -1, -1, 16);
if (psp->PlayerP->WpnRailType == 0)
InitRail(psp->PlayerP);
@ -4939,10 +4948,6 @@ pMicroAction(PANEL_SPRITEp psp)
void
pMicroFire(PANEL_SPRITEp psp)
{
int InitMicro(PLAYERp pp);
int InitRocket(PLAYERp pp);
int InitNuke(PLAYERp pp);
SpawnVis(psp->PlayerP->PlayerSprite, -1, -1, -1, -1, 20);
switch (psp->PlayerP->WpnRocketType)
{
@ -5268,6 +5273,7 @@ pHeartActionBlood(PANEL_SPRITEp psp)
SpawnHeartBlood(psp);
}
void InitHeartAttack(PLAYERp pp);
void
pHeartAttack(PANEL_SPRITEp psp)
@ -5275,7 +5281,6 @@ pHeartAttack(PANEL_SPRITEp psp)
PLAYERp pp = psp->PlayerP;
// CTW MODIFICATION
//int InitHeartAttack(PLAYERp pp);
void InitHeartAttack(PLAYERp pp);
// CTW MODIFICATION END
PlaySound(DIGI_HEARTFIRE,&pp->posx,&pp->posy,&pp->posz,v3df_follow|v3df_dontpan);
@ -5810,8 +5815,6 @@ pGrenadeAction(PANEL_SPRITEp psp)
void
pGrenadeFire(PANEL_SPRITEp psp)
{
int InitGrenade(PLAYERp pp);
SpawnVis(psp->PlayerP->PlayerSprite, -1, -1, -1, -1, 32);
InitGrenade(psp->PlayerP);
}
@ -6056,8 +6059,6 @@ pMineAction(PANEL_SPRITEp psp)
void
pMineThrow(PANEL_SPRITEp psp)
{
int InitMine(PLAYERp pp);
InitMine(psp->PlayerP);
}
@ -7018,8 +7019,6 @@ pFistAction(PANEL_SPRITEp psp)
void
pFistAttack(PANEL_SPRITEp psp)
{
int InitFistAttack(PLAYERp pp);
InitFistAttack(psp->PlayerP);
}

View file

@ -68,6 +68,15 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
void pSpriteControl(PLAYERp pp);
int WeaponOperate(PLAYERp pp);
SWBOOL MyCommPlayerQuit(void);
SECTOR_OBJECTp PlayerOnObject(short sectnum_match);
void PlayerRemoteReset(PLAYERp pp, short sectnum);
void KillAllPanelInv(PLAYERp pp);
void DoPlayerDeathDrown(PLAYERp pp);
void pWeaponForceRest(PLAYERp pp);
#define SO_DRIVE_SOUND 2
#define SO_IDLE_SOUND 1
@ -5888,7 +5897,6 @@ void DoPlayerOperateMatch(PLAYERp pp, SWBOOL starting)
void
DoPlayerBeginOperate(PLAYERp pp)
{
SECTOR_OBJECTp PlayerOnObject(short sectnum_match);
SECTOR_OBJECTp sop;
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
@ -5989,13 +5997,11 @@ DoPlayerBeginOperate(PLAYERp pp)
void
DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
{
SECTOR_OBJECTp PlayerOnObject(short sectnum_match);
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
int cz, fz;
int i;
short save_sectnum;
void PlayerRemoteReset(PLAYERp pp, short sectnum);
pp->sop_remote = pp->sop = pp->sop_control = sop;
sop->controller = pp->SpriteP;
@ -6498,9 +6504,6 @@ void
DoPlayerBeginDie(PLAYERp pp)
{
extern SWBOOL ReloadPrompt;
void KillAllPanelInv(PLAYERp pp);
void DoPlayerDeathDrown(PLAYERp pp);
void pWeaponForceRest(PLAYERp pp);
short bak;
int choosesnd = 0;
extern short GlobInfoStringTime;
@ -7938,12 +7941,10 @@ domovethings(void)
extern SWBOOL ResCheat;
extern int PlayClock;
short i, j, pnum, nexti;
int WeaponOperate(PLAYERp pp);
extern SWBOOL GamePaused;
extern SWBOOL GamePaused;
PLAYERp pp;
USERp u;
SPRITEp sp;
SWBOOL MyCommPlayerQuit(void);
extern unsigned int MoveThingsCount;
extern SWBOOL ScrollMode2D;
extern SWBOOL ReloadPrompt;
@ -8079,7 +8080,6 @@ domovethings(void)
{
extern short screenpeek;
extern SWBOOL PlayerTrackingMode;
void pSpriteControl(PLAYERp pp);
extern PLAYERp GlobPlayerP;
extern SWBOOL ScrollMode2D;

View file

@ -40,6 +40,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
int DoCheckSwarm(short SpriteNum);
ANIMATOR InitRipper2Hang;
ANIMATOR DoActorMoveJump;
ANIMATOR DoRipper2MoveJump;
@ -1315,8 +1317,7 @@ DoRipper2Move(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
int DoCheckSwarm(short SpriteNum);
if (sp->hitag == TAG_SWARMSPOT && sp->lotag == 1)
DoCheckSwarm(SpriteNum);

View file

@ -45,7 +45,7 @@ void *ReAllocMem(void *ptr, int size);
void FreeMem(void *ptr);
extern char ds[];
char lumplockbyte[11];
uint8_t lumplockbyte[11];
//=============
// STATICS

View file

@ -56,11 +56,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "colormap.h"
#include "player.h"
#include "saveable.h"
//void TimerFunc(task * Task);
BEGIN_SW_NS
// This cannot have a namespace declaration
#include "saveable.h"
/*
//////////////////////////////////////////////////////////////////////////////
TO DO

View file

@ -24,9 +24,10 @@
#include "ns.h"
#include "compat.h"
BEGIN_SW_NS
#include "saveable.h"
BEGIN_SW_NS
#define maxModules 35

View file

@ -24,7 +24,6 @@
#ifndef SAVEABLE_H
#define SAVEABLE_H
BEGIN_SW_NS
typedef void *saveable_code;
@ -69,6 +68,5 @@ int Saveable_FindDataSym(void *ptr, saveddatasym *sym);
int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr);
int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr);
END_SW_NS
#endif

View file

@ -38,6 +38,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "sprite.h"
#include "jsector.h"
#include "parent.h"
#include "scriptfile.h"
BEGIN_SW_NS
@ -377,7 +378,6 @@ void LoadPLockFromScript(const char *filename)
* Here begins JonoF's modding enhancement stuff
*/
#include "scriptfile.h"
enum
{

View file

@ -54,6 +54,10 @@ BEGIN_SW_NS
#define LAVAMAXDROPS 32
#define DEFAULT_DOOR_SPEED 800
int InitFireballTrap(short SpriteNum);
ANIMATOR DoGrating;
void DoPlayerBeginForceJump(PLAYERp);
short FindNextSectorByTag(short sectnum, int tag);
short LevelSecrets;
SWBOOL TestVatorMatchActive(short match);
@ -738,7 +742,6 @@ DoSpringBoard(PLAYERp pp, short sectnum)
{
int sb;
int i;
void DoPlayerBeginForceJump(PLAYERp);
#if 0
i = AnimGetGoal(&sector[sectnum].floorz);
@ -2025,7 +2028,6 @@ OperateSprite(short SpriteNum, short player_is_operating)
case TAG_SPRITE_GRATING:
{
USERp u;
ANIMATOR DoGrating;
change_sprite_stat(SpriteNum, STAT_NO_STATE);
@ -2125,7 +2127,6 @@ int DoTrapMatch(short match)
short i, nexti;
SPRITEp sp;
USERp u;
int InitFireballTrap(short SpriteNum);
// may need to be reset to fire immediately
@ -2352,7 +2353,6 @@ OperateContinuousTrigger(PLAYERp pp)
short i, nexti;
SPRITEp sp;
USERp u;
int InitFireballTrap(short SpriteNum);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRAP], i, nexti)
{

View file

@ -41,6 +41,7 @@ int InitSpriteChemBomb(short SpriteNum);
int InitFlashBomb(short SpriteNum);
int InitCaltrops(short SpriteNum);
int InitPhosphorus(int16_t SpriteNum);
SWBOOL SpriteOverlapZ(int16_t, int16_t, int);
//////////////////////
//
@ -389,7 +390,6 @@ int DoSkullJump(short SpriteNum)
// jump/fall type
if (sp->xvel)
{
SWBOOL SpriteOverlapZ(int16_t, int16_t, int);
int dist,a,b,c;
@ -804,8 +804,6 @@ int DoBettyJump(short SpriteNum)
// jump/fall type
if (sp->xvel)
{
SWBOOL SpriteOverlapZ(int16_t, int16_t, int);
int dist,a,b,c;
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);

View file

@ -51,7 +51,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "config.h"
#ifdef _WIN32
#include "winlayer.h"
#include "sdlayer.h"
#endif
BEGIN_SW_NS
@ -252,7 +252,7 @@ int PlayerYellVocs[] =
DIGI_PLAYERYELL3
};
extern char lumplockbyte[];
extern uint8_t lumplockbyte[];
#if 0
// DEBUG

View file

@ -33,8 +33,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "mytypes.h"
#ifndef sounds_public_
#define sounds_public_
#ifndef sw_sounds_public_
#define sw_sounds_public_
BEGIN_SW_NS
@ -149,7 +149,7 @@ struct VOCstruct
int16_t voc_num; // Backward reference to parent sound
int voc_distance; // Sound's distance effectiveness
Voc_Flags voc_flags; // Various allowable flag settings for voc
char lock; // locking byte for caching
uint8_t lock; // locking byte for caching
uint8_t playing; // number of this type of sound currently playing
};

View file

@ -50,6 +50,45 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
ANIMATOR SetupCoolie;
ANIMATOR SetupNinja;
ANIMATOR SetupGoro;
ANIMATOR SetupCoolg;
ANIMATOR SetupEel;
ANIMATOR SetupSumo;
ANIMATOR SetupZilla;
ANIMATOR SetupToiletGirl;
ANIMATOR SetupWashGirl;
ANIMATOR SetupCarGirl;
ANIMATOR SetupMechanicGirl;
ANIMATOR SetupSailorGirl;
ANIMATOR SetupPruneGirl;
ANIMATOR SetupTrashCan;
ANIMATOR SetupBunny;
ANIMATOR SetupRipper;
ANIMATOR SetupRipper2;
ANIMATOR SetupSerp;
ANIMATOR SetupLava;
ANIMATOR SetupSkel;
ANIMATOR SetupHornet;
ANIMATOR SetupSkull;
ANIMATOR SetupBetty;
ANIMATOR SetupPachinkoLight;
ANIMATOR SetupPachinko1;
ANIMATOR SetupPachinko2;
ANIMATOR SetupPachinko3;
ANIMATOR SetupPachinko4;
ANIMATOR SetupGirlNinja;
ANIMATOR DoVator, DoVatorAuto;
ANIMATOR DoRotator;
ANIMATOR DoSlidor;
ANIMATOR DoSpike, DoSpikeAuto;
ANIMATOR DoLavaErupt;
int DoSlidorInstantClose(short SpriteNum);
void InitWeaponRocket(PLAYERp);
void InitWeaponUzi(PLAYERp);
SWBOOL FAF_Sector(short sectnum);
SWBOOL MoveSkip4, MoveSkip2, MoveSkip8;
@ -1084,8 +1123,6 @@ ActorSpawn(SPRITEp sp)
{
case COOLIE_RUN_R0:
{
ANIMATOR SetupCoolie;
//PreCacheCoolie();
if (!ActorTestSpawn(sp))
@ -1103,7 +1140,6 @@ ActorSpawn(SPRITEp sp)
case NINJA_RUN_R0:
case NINJA_CRAWL_R0:
{
ANIMATOR SetupNinja;
//PreCacheNinja();
@ -1121,7 +1157,6 @@ ActorSpawn(SPRITEp sp)
case GORO_RUN_R0:
{
ANIMATOR SetupGoro;
//PreCacheGuardian();
@ -1139,7 +1174,6 @@ ActorSpawn(SPRITEp sp)
case 1441:
case COOLG_RUN_R0:
{
ANIMATOR SetupCoolg;
//PreCacheGhost();
@ -1156,7 +1190,6 @@ ActorSpawn(SPRITEp sp)
case EEL_RUN_R0:
{
ANIMATOR SetupEel;
//PreCacheEel();
@ -1173,7 +1206,6 @@ ActorSpawn(SPRITEp sp)
case SUMO_RUN_R0:
{
ANIMATOR SetupSumo;
//PreCacheSumo();
@ -1191,7 +1223,6 @@ ActorSpawn(SPRITEp sp)
case ZILLA_RUN_R0:
{
ANIMATOR SetupZilla;
//PreCacheSumo();
@ -1209,7 +1240,6 @@ ActorSpawn(SPRITEp sp)
case TOILETGIRL_R0:
{
ANIMATOR SetupToiletGirl;
//PreCacheToiletGirl();
@ -1227,7 +1257,6 @@ ActorSpawn(SPRITEp sp)
case WASHGIRL_R0:
{
ANIMATOR SetupWashGirl;
//PreCacheWashGirl();
@ -1245,7 +1274,6 @@ ActorSpawn(SPRITEp sp)
case CARGIRL_R0:
{
ANIMATOR SetupCarGirl;
//PreCacheCarGirl();
@ -1263,7 +1291,6 @@ ActorSpawn(SPRITEp sp)
case MECHANICGIRL_R0:
{
ANIMATOR SetupMechanicGirl;
//PreCacheMechanicGirl();
@ -1281,7 +1308,6 @@ ActorSpawn(SPRITEp sp)
case SAILORGIRL_R0:
{
ANIMATOR SetupSailorGirl;
//PreCacheSailorGirl();
@ -1299,7 +1325,6 @@ ActorSpawn(SPRITEp sp)
case PRUNEGIRL_R0:
{
ANIMATOR SetupPruneGirl;
//PreCachePruneGirl();
@ -1317,7 +1342,6 @@ ActorSpawn(SPRITEp sp)
case TRASHCAN:
{
ANIMATOR SetupTrashCan;
//PreCacheTrash();
PicAnimOff(sp->picnum);
@ -1328,7 +1352,6 @@ ActorSpawn(SPRITEp sp)
case BUNNY_RUN_R0:
{
ANIMATOR SetupBunny;
//PreCacheBunny();
@ -1345,7 +1368,6 @@ ActorSpawn(SPRITEp sp)
case RIPPER_RUN_R0:
{
ANIMATOR SetupRipper;
//PreCacheRipper();
@ -1362,7 +1384,6 @@ ActorSpawn(SPRITEp sp)
case RIPPER2_RUN_R0:
{
ANIMATOR SetupRipper2;
//PreCacheRipper2();
@ -1379,7 +1400,6 @@ ActorSpawn(SPRITEp sp)
case SERP_RUN_R0:
{
ANIMATOR SetupSerp;
//PreCacheSerpent();
@ -1396,7 +1416,6 @@ ActorSpawn(SPRITEp sp)
case LAVA_RUN_R0:
{
ANIMATOR SetupLava;
if (!ActorTestSpawn(sp))
{
@ -1411,7 +1430,6 @@ ActorSpawn(SPRITEp sp)
case SKEL_RUN_R0:
{
ANIMATOR SetupSkel;
//PreCacheSkel();
@ -1428,7 +1446,6 @@ ActorSpawn(SPRITEp sp)
case HORNET_RUN_R0:
{
ANIMATOR SetupHornet;
//PreCacheHornet();
@ -1445,7 +1462,6 @@ ActorSpawn(SPRITEp sp)
case SKULL_R0:
{
ANIMATOR SetupSkull;
//PreCacheSkull();
@ -1462,7 +1478,6 @@ ActorSpawn(SPRITEp sp)
case BETTY_R0:
{
ANIMATOR SetupBetty;
//PreCacheBetty();
@ -1479,7 +1494,6 @@ ActorSpawn(SPRITEp sp)
case 623: // Pachinko win light
{
ANIMATOR SetupPachinkoLight;
//PreCachePachinko();
PicAnimOff(sp->picnum);
@ -1489,7 +1503,6 @@ ActorSpawn(SPRITEp sp)
case PACHINKO1:
{
ANIMATOR SetupPachinko1;
//PreCachePachinko();
PicAnimOff(sp->picnum);
@ -1499,7 +1512,6 @@ ActorSpawn(SPRITEp sp)
case PACHINKO2:
{
ANIMATOR SetupPachinko2;
//PreCachePachinko();
PicAnimOff(sp->picnum);
@ -1509,7 +1521,6 @@ ActorSpawn(SPRITEp sp)
case PACHINKO3:
{
ANIMATOR SetupPachinko3;
//PreCachePachinko();
PicAnimOff(sp->picnum);
@ -1519,7 +1530,6 @@ ActorSpawn(SPRITEp sp)
case PACHINKO4:
{
ANIMATOR SetupPachinko4;
//PreCachePachinko();
PicAnimOff(sp->picnum);
@ -1529,7 +1539,6 @@ ActorSpawn(SPRITEp sp)
case GIRLNINJA_RUN_R0:
{
ANIMATOR SetupGirlNinja;
if (!ActorTestSpawn(sp))
{
@ -2249,7 +2258,6 @@ SpriteSetup(void)
case SECT_VATOR:
{
ANIMATOR DoVator, DoVatorAuto;
SECTORp sectp = &sector[sp->sectnum];
SECT_USERp sectu;
short speed,vel,time,type,start_on,floor_vator;
@ -2360,8 +2368,7 @@ SpriteSetup(void)
case SECT_ROTATOR:
{
ANIMATOR DoRotator;
SECTORp sectp = &sector[sp->sectnum];
SECTORp sectp = &sector[sp->sectnum];
SECT_USERp sectu;
short time,type;
short wallcount,startwall,endwall,w;
@ -2425,12 +2432,10 @@ SpriteSetup(void)
case SECT_SLIDOR:
{
ANIMATOR DoSlidor;
SECTORp sectp = &sector[sp->sectnum];
SECT_USERp sectu;
short time,type;
short wallcount,startwall,endwall,w;
int DoSlidorInstantClose(short SpriteNum);
u = SpawnUser(SpriteNum, 0, NULL);
@ -2481,7 +2486,6 @@ SpriteSetup(void)
case SECT_SPIKE:
{
ANIMATOR DoSpike, DoSpikeAuto;
short speed,vel,time,type,start_on,floor_vator;
int floorz,ceilingz,trash;
u = SpawnUser(SpriteNum, 0, NULL);
@ -2701,7 +2705,6 @@ SpriteSetup(void)
case LAVA_ERUPT:
{
ANIMATOR DoLavaErupt;
u = SpawnUser(SpriteNum, ST1, NULL);
@ -5590,8 +5593,6 @@ DoGet(short SpriteNum)
PLAYERp pp;
short pnum, key_num;
int dist, a,b,c;
void InitWeaponRocket(PLAYERp);
void InitWeaponUzi(PLAYERp);
SWBOOL can_see;
int cstat_bak;

View file

@ -23,7 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
BEGIN_SW_NS
#ifdef MAKE_STAG_ENUM
#define STAG_ENTRY(st1_name, number, flgs) st1_name = number,
@ -228,4 +227,3 @@ STAG_ENTRY(ECHOSPOT, 1005, 0)
STAG_ENTRY(DRIP_GENERATOR, 1006, 0)
#undef STAG_ENTRY
END_SW_NS

View file

@ -261,9 +261,9 @@ static void SetPage(int n)
HWND tab;
int cur;
tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
cur = (int)SendMessage(tab, TCM_GETCURSEL,0,0);
cur = (int)SendMessageA(tab, TCM_GETCURSEL,0,0);
ShowWindow(pages[cur],SW_HIDE);
SendMessage(tab, TCM_SETCURSEL, n, 0);
SendMessageA(tab, TCM_SETCURSEL, n, 0);
ShowWindow(pages[n],SW_SHOW);
mode = n;
@ -325,7 +325,7 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
// Load the bitmap into the bitmap control and fetch its dimensions
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
SendMessageA(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
GetClientRect(hwnd, &r);
xoffset = r.right;
yoffset = r.bottom - rdlg.bottom;
@ -352,28 +352,28 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
// Add tabs to the tab control
{
TCITEM tab;
TCITEMA tab;
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
ZeroMemory(&tab, sizeof(tab));
tab.mask = TCIF_TEXT;
static char textConfiguration[] = TEXT("Configuration");
static char textConfiguration[] = ("Configuration");
tab.pszText = textConfiguration;
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
SendMessageA(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
tab.mask = TCIF_TEXT;
static char textGame[] = TEXT("Game");
static char textGame[] = ("Game");
tab.pszText = textGame;
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
SendMessageA(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
tab.mask = TCIF_TEXT;
static char textMessages[] = TEXT("Messages");
static char textMessages[] = ("Messages");
tab.pszText = textMessages;
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
SendMessageA(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
// Work out the position and size of the area inside the tab control for the pages
ZeroMemory(&r, sizeof(r));
GetClientRect(hwnd, &r);
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
SendMessageA(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
r.right -= r.left-1;
r.bottom -= r.top-1;
r.top += rtab.top;
@ -393,7 +393,7 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
GetClientRect(pages[TAB_MESSAGES],&r);
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
r.left = r.top = 0;
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
SendMessageA(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
// Set a tab stop in the game data listbox
{
@ -402,7 +402,7 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
}
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
SetWindowText(hwndDlg, apptitle);
SetWindowTextA(hwndDlg, apptitle);
}
return FALSE;
}
@ -412,7 +412,7 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPNMHDR nmhdr = (LPNMHDR)lParam;
int cur;
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
cur = (int)SendMessageA(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
switch (nmhdr->code)
{
case TCN_SELCHANGING:
@ -552,18 +552,18 @@ int startwin_puts(const char *buf)
edctl = pages[TAB_MESSAGES];
if (!edctl) return -1;
vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES);
vis = ((int)SendMessageA(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES);
if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0);
curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
if (vis) SendMessageA(edctl, WM_SETREDRAW, FALSE,0);
curlen = SendMessageA(edctl, WM_GETTEXTLENGTH, 0,0);
SendMessageA(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
linesbefore = SendMessageA(edctl, EM_GETLINECOUNT, 0,0);
p = buf;
while (*p)
{
if (newline)
{
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
SendMessageA(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
newline = 0;
}
q = p;
@ -589,18 +589,18 @@ int startwin_puts(const char *buf)
workbuf[q-p] = 0;
p = q;
}
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
SendMessageA(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
}
linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0);
linesafter = SendMessageA(edctl, EM_GETLINECOUNT, 0,0);
SendMessageA(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
if (vis) SendMessageA(edctl, WM_SETREDRAW, TRUE,0);
return 0;
}
int startwin_settitle(const char *str)
{
if (!startupdlg) return 1;
SetWindowText(startupdlg, str);
SetWindowTextA(startupdlg, str);
return 0;
}

View file

@ -44,6 +44,11 @@ BEGIN_SW_NS
void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny);
void DoAutoTurretObject(SECTOR_OBJECTp sop);
void DoTornadoObject(SECTOR_OBJECTp sop);
int DoActorMoveJump(short SpriteNum);
int PickJumpSpeed(short SpriteNum, int pix_height);
SPRITEp FindNearSprite(SPRITEp, short);
ANIMATOR DoActorMoveJump;
ANIMATOR NinjaJumpActionFunc;
#define ACTOR_STD_JUMP (-384)
int GlobSpeedSO;
@ -3272,8 +3277,6 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
case TRACK_ACTOR_QUICK_SUPER_JUMP:
if (u->ActorActionSet->Jump)
{
int DoActorMoveJump(short SpriteNum);
int PickJumpSpeed(short SpriteNum, int pix_height);
int zdiff;
hitdata_t hitinfo;
@ -3609,7 +3612,6 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
int bos_z,nx,ny;
int dist;
SPRITEp lsp;
SPRITEp FindNearSprite(SPRITEp, short);
//
// Get angle and x,y pos from CLIMB_MARKER
@ -3828,8 +3830,6 @@ ActorFollowTrack(short SpriteNum, short locktics)
{
if (SPRITEp_TOS(sp) + DIV4(SPRITEp_SIZE_Z(sp)) < u->sz)
{
ANIMATOR DoActorMoveJump;
ANIMATOR NinjaJumpActionFunc;
RESET(u->Flags, SPR_CLIMBING);
sp->zvel = 0;

View file

@ -50,6 +50,15 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
int SpawnZombie2(short);
int move_ground_missile(short spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics);
void DoPlayerBeginDie(PLAYERp);
void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator);
ANIMATOR DoBettyBeginDeath;
ANIMATOR DoSkullBeginDeath;
ANIMATOR DoRipperGrow;
ANIMATOR InitMineShrap;
//
// Damage Amounts defined in damage.h
//
@ -5109,14 +5118,12 @@ ActorChooseDeath(short SpriteNum, short Weapon)
{
case BETTY_R0:
{
ANIMATOR DoBettyBeginDeath;
DoBettyBeginDeath(SpriteNum);
break;
}
case SKULL_R0:
{
ANIMATOR DoSkullBeginDeath;
DoSkullBeginDeath(SpriteNum);
DoSkullBeginDeath(SpriteNum);
break;
}
case TOILETGIRL_R0:
@ -5451,7 +5458,6 @@ SopCheckKill(SECTOR_OBJECTp sop)
SPRITEp sp = sop->sp_child;
USERp u = User[sp - sprite];
SWBOOL killed = FALSE;
void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator);
if (TEST(sop->flags, SOBJ_BROKEN))
return FALSE;
@ -5759,7 +5765,6 @@ PlayerCheckDeath(PLAYERp pp, short Weapon)
if (u->Health <= 0 && !TEST(pp->Flags, PF_DEAD))
{
void DoPlayerBeginDie(PLAYERp);
// pick a death type
if (u->LastDamage >= PLAYER_DEATH_EXPLODE_DAMMAGE_AMT)
@ -7350,8 +7355,7 @@ DoDamage(short SpriteNum, short Weapon)
}
else if (u->ID == RIPPER_RUN_R0)
{
ANIMATOR DoRipperGrow;
DoRipperGrow(SpriteNum);
DoRipperGrow(SpriteNum);
break;
}
@ -11645,8 +11649,7 @@ SpawnGrenadeExp(int16_t Weapon)
SPRITEp exp;
USERp eu;
short explosion;
ANIMATOR InitMineShrap;
short ang;
short ang;
int dx,dy,dz;
ASSERT(u);
@ -12377,12 +12380,10 @@ DoBloodWorm(int16_t Weapon)
SPRITEp sp = &sprite[Weapon], exp;
USERp u = User[Weapon];
int offset;
int move_ground_missile(short spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics);
short ang;
int x,y,z,xvect,yvect;
int bx,by;
int amt;
int SpawnZombie2(short);
short sectnum;
u = User[Weapon];
@ -12471,12 +12472,10 @@ DoBloodWorm(int16_t Weapon)
SPRITEp sp = &sprite[Weapon], exp;
USERp u = User[Weapon];
int offset;
int move_ground_missile(short spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics);
short ang;
short ang;
int x,y,z,xvect,yvect;
int bx,by;
int amt;
int SpawnZombie2(short);
short sectnum;
u = User[Weapon];