From 557bd201fbf8672e16ed80bffd611a79d5c28354 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Nov 2019 18:02:17 +0100 Subject: [PATCH] - removed unused code. (MDA screen hack - huh???) - Shadow Warrior updates from SWP. --- source/sw/CMakeLists.txt | 2 +- source/sw/src/actor.cpp | 17 +- source/sw/src/border.cpp | 10 +- source/sw/src/break.cpp | 20 +- source/sw/src/cheats.cpp | 330 +++++++++++++++++++------------- source/sw/src/colormap.cpp | 11 +- source/sw/src/console.cpp | 16 +- source/sw/src/coolie.cpp | 11 +- source/sw/src/copysect.cpp | 3 +- source/sw/src/draw.cpp | 67 +------ source/sw/src/game.cpp | 376 +++++++++---------------------------- source/sw/src/game.h | 12 +- source/sw/src/hornet.cpp | 32 ++-- source/sw/src/inv.cpp | 65 +++---- source/sw/src/inv.h | 2 +- source/sw/src/jplayer.cpp | 2 +- source/sw/src/jsector.cpp | 100 +--------- source/sw/src/mdastr.cpp | 87 --------- source/sw/src/menus.cpp | 181 +++++++----------- source/sw/src/menus.h | 2 +- source/sw/src/names2.h | 2 + source/sw/src/network.cpp | 24 --- source/sw/src/ninja.cpp | 40 +++- source/sw/src/panel.cpp | 75 ++++---- source/sw/src/player.cpp | 24 ++- source/sw/src/save.cpp | 7 +- source/sw/src/scrip2.cpp | 35 ++-- source/sw/src/sector.cpp | 2 +- source/sw/src/sounds.cpp | 13 +- source/sw/src/sprite.cpp | 19 +- source/sw/src/sumo.cpp | 8 +- source/sw/src/swcvar.cpp | 3 + source/sw/src/swcvar.h | 4 + source/sw/src/text.cpp | 54 ++---- source/sw/src/text.h | 2 +- source/sw/src/track.cpp | 3 +- source/sw/src/weapon.cpp | 8 +- 37 files changed, 657 insertions(+), 1012 deletions(-) delete mode 100644 source/sw/src/mdastr.cpp create mode 100644 source/sw/src/swcvar.cpp create mode 100644 source/sw/src/swcvar.h diff --git a/source/sw/CMakeLists.txt b/source/sw/CMakeLists.txt index bd1f829f5..197582dcd 100644 --- a/source/sw/CMakeLists.txt +++ b/source/sw/CMakeLists.txt @@ -64,7 +64,6 @@ set( PCH_SOURCES src/lava.cpp src/light.cpp src/mclip.cpp - src/mdastr.cpp src/menus.cpp src/miscactr.cpp src/morph.cpp @@ -102,6 +101,7 @@ set( PCH_SOURCES src/weapon.cpp src/zilla.cpp src/zombie.cpp + src/swcvar.cpp ) diff --git a/source/sw/src/actor.cpp b/source/sw/src/actor.cpp index 349aad2cf..5f4994a0d 100644 --- a/source/sw/src/actor.cpp +++ b/source/sw/src/actor.cpp @@ -25,6 +25,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms //------------------------------------------------------------------------- #include "ns.h" +// Added Ninja Sliced fix +// Fixed Ninja sliced dead and rotation +// Added s_NinjaDieSlicedHack[] +// #include "build.h" @@ -36,6 +40,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "weapon.h" #include "sprite.h" #include "actor.h" +#include "swcvar.h" BEGIN_SW_NS @@ -46,6 +51,7 @@ extern STATE s_DebrisRat[]; extern STATE s_DebrisCrab[]; extern STATE s_DebrisStarFish[]; extern STATE s_NinjaDieSliced[]; +extern STATE s_NinjaDieSlicedHack[]; extern STATEp sg_NinjaGrabThroat[]; @@ -141,11 +147,15 @@ DoActorDie(short SpriteNum, short weapon) if (User[weapon]->WeaponNum != WPN_FIST) { - //SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1); + if (sw_ninjahack) + SpawnBlood(SpriteNum, SpriteNum, -1, -1, -1, -1); InitPlasmaFountain(wp, sp); InitPlasmaFountain(wp, sp); PlaySound(DIGI_NINJAINHALF,&sp->x,&sp->y,&sp->z,v3df_none); - ChangeState(SpriteNum, &s_NinjaDieSliced[0]); + if (sw_ninjahack) + ChangeState(SpriteNum, &s_NinjaDieSlicedHack[5]); + else + ChangeState(SpriteNum, &s_NinjaDieSliced[0]); } else { @@ -179,7 +189,8 @@ DoActorDie(short SpriteNum, short weapon) u->ActorActionFunc = NULL; //u->ActorActionFunc = NullAnimator; - sprite[SpriteNum].ang = sprite[weapon].ang; + if (!sw_ninjahack) + sprite[SpriteNum].ang = sprite[weapon].ang; break; case COOLG_RUN_R0: diff --git a/source/sw/src/border.cpp b/source/sw/src/border.cpp index ed83bf6d0..5f042d291 100644 --- a/source/sw/src/border.cpp +++ b/source/sw/src/border.cpp @@ -24,6 +24,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- #include "ns.h" +// Added improved crosshair accuracy +// Added UsingMenus for fragbar +// #include "build.h" @@ -35,9 +38,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "common_game.h" #include "network.h" #include "text.h" +#include "menus.h" BEGIN_SW_NS + + #define BAR_HEIGHT 48 #define XDIM 320 #define YDIM 200 @@ -418,8 +424,7 @@ void DrawPanelBorderSides(PLAYERp pp, short x, short y, short x2, short y2, shor } } -static -void BorderSetView(PLAYERp UNUSED(pp), int *Xdim, int *Ydim, int *ScreenSize) +static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize) { int x, x2, y, y2; BORDER_INFO *b; @@ -565,7 +570,6 @@ void SetRedrawScreen(PLAYERp pp) { int i, j; - //int x, x2, y, y2; BORDER_INFO *b; if (pp != Player + myconnectindex) diff --git a/source/sw/src/break.cpp b/source/sw/src/break.cpp index 916076ef0..fd2abc9dd 100644 --- a/source/sw/src/break.cpp +++ b/source/sw/src/break.cpp @@ -444,15 +444,21 @@ static int CompareBreakInfo(void const * a, void const * b) return break_info1->picnum - break_info2->picnum; } +int CompareSearchBreakInfo(short *picnum, BREAK_INFOp break_info) + { + // will return a number less than 0 if picnum < break_info->picnum + return(*picnum - break_info->picnum); + } + BREAK_INFOp FindWallBreakInfo(short picnum) -{ - return (BREAK_INFOp)bsearch(&picnum, &WallBreakInfo, SIZ(WallBreakInfo), sizeof(BREAK_INFO), CompareBreakInfo); -} + { + return(BREAK_INFOp)(bsearch(&picnum, &WallBreakInfo, SIZ(WallBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo)); + } BREAK_INFOp FindSpriteBreakInfo(short picnum) -{ - return (BREAK_INFOp)bsearch(&picnum, &SpriteBreakInfo, SIZ(SpriteBreakInfo), sizeof(BREAK_INFO), CompareBreakInfo); -} + { + return(BREAK_INFOp)(bsearch(&picnum, &SpriteBreakInfo, SIZ(SpriteBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo)); + } ////////////////////////////////////////////// // SETUP @@ -661,7 +667,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short return TRUE; } -SWBOOL UserBreakWall(WALLp wp, short UNUSED(ang)) +SWBOOL UserBreakWall(WALLp wp, short) { short SpriteNum; SPRITEp sp; diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index 3c3f6e655..8c7ce438b 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -23,6 +23,15 @@ Original Source: 1997 - Frank Maddin and Jim Norwood Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- +// From SWP: +// Added SWKEYS +// Added SWGUN# and SWGOD +// Added SWMEDIC (25%) +// Added Full name key cheats - swbluecard - swgoldkey +// Added swquit +// Added 2 uzi's for swgimme +// + #include "ns.h" #include "build.h" @@ -45,61 +54,61 @@ char CheatInputString[256]; SWBOOL EveryCheat = FALSE; SWBOOL ResCheat = FALSE; -void ResCheatOn(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +const char *CheatKeyType; +void KeysCheat(PLAYERp pp, const char *cheat_string); + +void ResCheatOn(PLAYERp, const char *) { ResCheat = TRUE; } -void VoxCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void VoxCheat(PLAYERp, const char *) { //gs.Voxel ^= 1; } -void RestartCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void RestartCheat(PLAYERp, const char *) { ExitLevel = TRUE; } -void RoomCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void RoomCheat(PLAYERp, const char *) { extern SWBOOL FAF_DebugView; FAF_DebugView ^= 1; } -void SecretCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void SecretCheat(PLAYERp pp, const char *) { hud_stats = !hud_stats; } -void NextCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void NextCheat(PLAYERp pp, const char *) { Level++; ExitLevel = TRUE; } -void PrevCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void PrevCheat(PLAYERp pp, const char *) { Level--; ExitLevel = TRUE; } -static int32_t showallmap; - -void MapCheat(PLAYERp pp, char *UNUSED(cheat_string)) +void MapCheat(PLAYERp pp, const char *) { - showallmap ^= 1; + automapping ^= 1; - if (showallmap) + if (automapping) MapSetAll2D(0); else MapSetAll2D(0xFF); - sprintf(ds, "SHOWALLMAP %s", showallmap ? "ON" : "OFF"); + sprintf(ds, "AUTOMAPPING %s", automapping ? "ON" : "OFF" ); PutStringInfo(pp, ds); } - -void LocCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) +void LocCheat(PLAYERp pp, const char *) { extern SWBOOL LocationInfo; LocationInfo++; @@ -107,8 +116,46 @@ void LocCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) LocationInfo = 0; } +void GunsCheat(PLAYERp pp, const char *cheat_string) +{ + PLAYERp p; + short pnum; + unsigned int i; + short gAmmo[10] = {0,9,12,20,3,6,5,5,10,1}; + const char *cp = cheat_string; + const char *str = "GIVEN WEAPON %1d"; + int gunnum, x; + USERp u; -void WeaponCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) + cp += sizeof("swgun")-1; + gunnum = atol(cp); + if (gunnum == 0) + gunnum = 10; + if (gunnum < 2 || gunnum > 10) + return; + + TRAVERSE_CONNECT(pnum) + { + p = &Player[pnum]; + u = User[p->PlayerSprite]; + x = gAmmo[gunnum-1]; + if (TEST(p->WpnFlags, BIT(gunnum-1)) == 0) + p->WpnFlags += BIT(gunnum-2) << 1; + else + str = "ADD AMMO TO WEAPON %1d"; + p->WpnAmmo[gunnum-1] += x; + if (p->WpnAmmo[gunnum-1] > DamageData[gunnum-1].max_ammo) + { + p->WpnAmmo[gunnum-1] = DamageData[gunnum-1].max_ammo; + str = ""; + } + PlayerUpdateWeapon(p, u->WeaponNum); + } + sprintf(ds, str, gunnum); + PutStringInfo(pp, ds); +} + +void WeaponCheat(PLAYERp pp, const char *) { PLAYERp p; short pnum; @@ -135,8 +182,7 @@ void WeaponCheat(PLAYERp UNUSED(pp), char *UNUSED(cheat_string)) } } - -void GodCheat(PLAYERp pp, char *UNUSED(cheat_string)) +void GodCheat(PLAYERp pp, const char *) { // // GOD mode @@ -147,7 +193,7 @@ void GodCheat(PLAYERp pp, char *UNUSED(cheat_string)) PutStringInfo(pp, ds); } -void ClipCheat(PLAYERp pp, char *UNUSED(cheat_string)) +void ClipCheat(PLAYERp pp, const char *) { FLIP(pp->Flags, PF_CLIP_CHEAT); @@ -155,9 +201,9 @@ void ClipCheat(PLAYERp pp, char *UNUSED(cheat_string)) PutStringInfo(pp, ds); } -void WarpCheat(PLAYERp pp, char *cheat_string) +void WarpCheat(PLAYERp pp, const char *cheat_string) { - char *cp = cheat_string; + const char *cp = cheat_string; int episode_num; int level_num; @@ -185,7 +231,7 @@ void WarpCheat(PLAYERp pp, char *cheat_string) PutStringInfo(pp, ds); } -void ItemCheat(PLAYERp pp, char *cheat_string) +void ItemCheat(PLAYERp pp, const char *cheat_string) { // // Get all ITEMS @@ -236,7 +282,121 @@ void ItemCheat(PLAYERp pp, char *cheat_string) PlayerUpdateKeys(pp); } -void EveryCheatToggle(PLAYERp pp, char *cheat_string) +VOID HealCheat(PLAYERp pp, const char *cheat_string) +{ + short pnum; + const char *str = ""; + + TRAVERSE_CONNECT(pnum) + { + if (User[Player[pnum].PlayerSprite]->Health < pp->MaxHealth) + str = "ADDED HEALTH"; + User[Player[pnum].PlayerSprite]->Health += 25; + } + PutStringInfo(pp, str); +} + +VOID SortKeyCheat(PLAYERp pp, const char *sKey) +{ + const char *sTemp = ""; + + CheatKeyType = ""; + + if (Bstrncasecmp(sKey, "swredcard",9) == 0) + { + sTemp = "swkey1"; + CheatKeyType = "Red Cardkey"; + } + else + if (Bstrncasecmp(sKey, "swbluecard",10) == 0) + { + sTemp = "swkey2"; + CheatKeyType = "Blue Cardkey"; + } + else + if (Bstrncasecmp(sKey, "swgreencard",11) == 0) + { + sTemp = "swkey3"; + CheatKeyType = "Green Cardkey"; + } + else + if (Bstrncasecmp(sKey, "swyellowcard",12) == 0) + { + sTemp = "swkey4"; + CheatKeyType = "Yellow Cardkey"; + } + else + if (Bstrncasecmp(sKey, "swgoldkey",9) == 0) + { + sTemp = "swkey5"; + CheatKeyType = "Gold Key"; + } + else + if (Bstrncasecmp(sKey, "swsilverkey",11) == 0) + { + sTemp = "swkey6"; + CheatKeyType = "Silver Key"; + } + else + if (Bstrncasecmp(sKey, "swbronzekey",11) == 0) + { + sTemp = "swkey7"; + CheatKeyType = "Bronze Key"; + } + else + if (Bstrncasecmp(sKey, "swredkey",8) == 0) + { + sTemp = "swkey8"; + CheatKeyType = "Red Key"; + } + + if (Bstrncmp(sTemp, "", 1) != 0) + KeysCheat(pp, sTemp); +} + +VOID KeysCheat(PLAYERp pp, const char *cheat_string) +{ + // Get KEYS + PLAYERp p; + short pnum; + const char *cp = cheat_string; + const char *str = "Given all keys"; + int keynum = 0; + + cp += sizeof("swkey")-1; + keynum = atol(cp); + + TRAVERSE_CONNECT(pnum) + { + p = &Player[pnum]; + if (keynum < 1 || keynum > 8) + { + memset(p->HasKey, TRUE, sizeof(p->HasKey)); + keynum = 0; + } + else + { + if (p->HasKey[keynum-1] == FALSE) + { + p->HasKey[keynum-1] = TRUE; // cards: 0=red 1=blue 2=green 3=yellow | keys: 4=gold 5=silver 6=bronze 7=red + str = "Given %s"; + } + else + { + p->HasKey[keynum-1] = FALSE; + str = "Removed %s"; + } + } + } + PlayerUpdateKeys(pp); + if (keynum == 0) + sprintf(ds, str); + else + sprintf(ds, str, CheatKeyType); + PutStringInfo(pp, ds); +} + +void EveryCheatToggle(PLAYERp pp, const char *cheat_string) { EveryCheat ^= 1; @@ -248,16 +408,12 @@ void EveryCheatToggle(PLAYERp pp, char *cheat_string) PutStringInfo(pp, ds); } -void SaveCheat(PLAYERp pp, char *UNUSED(cheat_string)) -{ -} - -void GeorgeFunc(PLAYERp pp, char *UNUSED(cheat_string)) +void GeorgeFunc(PLAYERp pp, char *) { PlayerSound(DIGI_TAUNTAI9,&pp->posx,&pp->posy,&pp->posz,v3df_dontpan|v3df_doppler|v3df_follow,pp); } -void BlackburnFunc(PLAYERp pp, char *UNUSED(cheat_string)) +void BlackburnFunc(PLAYERp pp, char *) { PlayerSound(DIGI_TAUNTAI3,&pp->posx,&pp->posy,&pp->posz,v3df_dontpan|v3df_doppler|v3df_follow,pp); } @@ -290,15 +446,27 @@ int cheatcmp(const char *str1, const char *str2, int len) typedef struct { const char *CheatInputCode; - void (*CheatInputFunc)(PLAYERp, char *); + void (*CheatInputFunc)(PLAYERp, const char *); char flags; -} CHEAT_INFO, *CHEAT_INFOp; +}CHEAT_INFO, *CHEAT_INFOp; CHEAT_INFO ci[] = -{ - {"swchan", GodCheat, 0}, - {"swgimme", ItemCheat, 0}, + { + {"swgod", GodCheat, 0}, + {"swchan", GodCheat, 0}, + {"swgimme", ItemCheat, 0}, + {"swmedic", HealCheat, 0}, + {"swkeys", KeysCheat, 0}, + {"swredcard", SortKeyCheat, 0}, + {"swbluecard", SortKeyCheat, 0}, + {"swgreencard", SortKeyCheat, 0}, + {"swyellowcard", SortKeyCheat, 0}, + {"swgoldkey", SortKeyCheat, 0}, + {"swsilverkey", SortKeyCheat, 0}, + {"swbronzekey", SortKeyCheat, 0}, + {"swredkey", SortKeyCheat, 0}, + {"swgun#", GunsCheat, 0}, {"swtrek##", WarpCheat, 0}, {"swgreed", EveryCheatToggle, 0}, {"swghost", ClipCheat, 0}, @@ -308,7 +476,6 @@ CHEAT_INFO ci[] = {"swres", ResCheatOn, 0}, {"swloc", LocCheat, 0}, {"swmap", MapCheat, 0}, - {"swsave", SaveCheat, CF_ALL}, {"swroom", RoomCheat, CF_NOTSW}, // Room above room dbug #if DEBUG {"swsecret", SecretCheat, CF_ALL}, @@ -375,100 +542,7 @@ void CheatInput(void) if (!match) { - ////DSPRINTF(ds,"Lost A Match %s", CheatInputString); - //MONO_PRINT(ds); - CheatInputMode = FALSE; } } - -/* OLD CODE -void CheatInput(void) - { - static SWBOOL cur_show; - signed char MNU_InputString(char *, short); - int ret; - SWBOOL match = FALSE; - short i; - - // don't use InputMode here - its set for CheatInputMode - if (MessageInputMode || MenuInputMode) - return; - - if (!CheatInputMode) - { - if (inputState.GetKeyStatus(KEYSC_S)) - { - //inputState.GetKeyStatus(KEYSC_S) = FALSE; - CheatInputMode = TRUE; - strcpy(CheatInputString,"s"); - } - } - - if (CheatInputMode) - { - // get new chars - ret = MNU_InputString(CheatInputString, 320-20); - - // quick check input - switch (ret) - { - case FALSE: // Input finished (RETURN) - case -1: // Cancel Input (pressed ESC) or Err - CheatInputMode = FALSE; - inputState.keyFlushChars(); - return; - - case TRUE: // Got input - break; - } - - // make sure string is lower cased - Bstrlwr(CheatInputString); - - // check for at least one single match - for (i = 0; i < SIZ(ci); i++) - { - // compare without the NULL - if (cheatcmp(CheatInputString, ci[i].CheatInputCode, strlen(CheatInputString)) == 0) - { - ////DSPRINTF(ds,"%s",CheatInputString); - //MONO_PRINT(ds); - - // if they are equal in length then its a complet match - if (strlen(CheatInputString) == strlen(ci[i].CheatInputCode)) - { - ////DSPRINTF(ds,"Found A Match %s", CheatInputString); - //MONO_PRINT(ds); - - match = TRUE; - - CheatInputMode = FALSE; - inputState.keyFlushChars(); - - if (ci[i].CheatInputFunc) - (*ci[i].CheatInputFunc)(Player, CheatInputString); - - return; - } - else - { - match = TRUE; - break; - } - } - } - - if (!match) - { - ////DSPRINTF(ds,"Lost A Match %s", CheatInputString); - //MONO_PRINT(ds); - - CheatInputMode = FALSE; - inputState.keyFlushChars(); - } - } - } - -*/ END_SW_NS diff --git a/source/sw/src/colormap.cpp b/source/sw/src/colormap.cpp index b81b1bf86..b85fb62ce 100644 --- a/source/sw/src/colormap.cpp +++ b/source/sw/src/colormap.cpp @@ -280,20 +280,21 @@ InitPalette(void) // // Dive palettes // +#define FOG_AMT 60 // is 15 in SWP. +#define LAVA_AMT 44 // is 11 in SWP. for (i = 0; i < 256; i++) tempbuf[i] = i; // palette for underwater - paletteMakeLookupTable(PALETTE_DIVE, tempbuf, 0, 0, 60, TRUE); + paletteMakeLookupTable(PALETTE_DIVE, tempbuf, 0, 0, FOG_AMT, TRUE); -#define FOG_AMT 60 for (i = 0; i < 256; i++) tempbuf[i] = i; paletteMakeLookupTable(PALETTE_FOG, tempbuf, FOG_AMT, FOG_AMT, FOG_AMT, TRUE); for (i = 0; i < 256; i++) tempbuf[i] = i; - paletteMakeLookupTable(PALETTE_DIVE_LAVA, tempbuf, 44, 0, 0, TRUE); + paletteMakeLookupTable(PALETTE_DIVE_LAVA, tempbuf, LAVA_AMT, 0, 0, TRUE); // // 1 Range changes @@ -385,9 +386,9 @@ do 4 bytes and RGB are backwards.Here are the function prototypes: - VBE_setPalette(long palstart, long palnum, char *dapal); + VBE_setPalette(int palstart, int palnum, char *dapal); -VBE_getPalette(long palstart, long palnum, char *dapal); +VBE_getPalette(int palstart, int palnum, char *dapal); palstart is the offset of the first palette to set palnum is the number of the palette entries to set dapal is a pointer to the palette buffer.The palette diff --git a/source/sw/src/console.cpp b/source/sw/src/console.cpp index abf541044..e9228f835 100644 --- a/source/sw/src/console.cpp +++ b/source/sw/src/console.cpp @@ -147,6 +147,7 @@ CON_COMMAND pre_commands[] = {"help", CON_GetHelp}, //{"quit", CON_Quit}, #endif + {"swgod", CheatInput}, {"swchan", CheatInput}, {"swgimme", CheatInput}, {"swtrek##", CheatInput}, @@ -157,6 +158,19 @@ CON_COMMAND pre_commands[] = {"swloc", CheatInput}, {"swmap", CheatInput}, {"swsave", CheatInput}, + {"swmedic", CheatInput}, + {"swkeys", CheatInput}, + {"swredcard", CheatInput}, + {"swbluecard", CheatInput}, + {"swgreencard", CheatInput}, + {"swyellowcard", CheatInput}, + {"swgoldkey", CheatInput}, + {"swsilverkey", CheatInput}, + {"swbronzekey", CheatInput}, + {"swredkey", CheatInput}, + {"swgun#", CheatInput}, + {"swquit", CheatInput}, + {"swexit", CheatInput}, {"sound", CON_SoundTest}, {"winpachinko", CON_WinPachinko}, {"config", CON_LoadSetup}, @@ -212,7 +226,7 @@ uint8_t CON_CommandCmp(const char *str1, const char *str2, int len) return TRUE; } -SWBOOL IsCommand(char *str) +SWBOOL IsCommand(const char *str) { int i; char first[512]; diff --git a/source/sw/src/coolie.cpp b/source/sw/src/coolie.cpp index 5acdc3b8e..2280b53f1 100644 --- a/source/sw/src/coolie.cpp +++ b/source/sw/src/coolie.cpp @@ -343,6 +343,11 @@ STATEp sg_CoolieDead[] = s_CoolieDead }; +STATE s_CoolieDeadHead[] = + { + {COOLIE_DEAD_HEAD, COOLIE_DIE_RATE, DoActorDebris, &s_CoolieDeadHead[0]} + }; + /* typedef struct { @@ -572,7 +577,11 @@ int SpawnCoolg(short SpriteNum) USERp u = User[SpriteNum]; // Don't do a ghost every time - if (RANDOM_RANGE(1000) > 700) return 0; + if (RANDOM_RANGE(1000) > 700) + { + ChangeState(SpriteNum,&s_CoolieDeadHead[0]); + return(0); + } NewCoolg(SpriteNum); diff --git a/source/sw/src/copysect.cpp b/source/sw/src/copysect.cpp index e0e50e84a..9f04672f1 100644 --- a/source/sw/src/copysect.cpp +++ b/source/sw/src/copysect.cpp @@ -36,6 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS +extern int GlobSpeedSO; + void CopySectorWalls(short dest_sectnum, short src_sectnum) { short dest_wall_num, src_wall_num, start_wall; @@ -167,7 +169,6 @@ void CopySectorMatch(short match) if (TEST(sector[dest_sp->sectnum].extra, SECTFX_SECTOR_OBJECT)) { SECTOR_OBJECTp sop; - extern int GlobSpeedSO; // find and add sprite to SO sop = DetectSectorObject(§or[sprite[src_move].sectnum]); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index fb26b8132..0c39cb82d 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1602,7 +1602,7 @@ void ResChange(void) for (i = 0; i < numpages; i++) { clearview(0); - nextpage(); + videoNextPage(); } // needs to be called from drawscreen - crashes otherwise @@ -1654,7 +1654,7 @@ void ResChange(void) for (i = 0; i < numpages; i++) { clearview(0); - nextpage(); + videoNextPage(); } SetupAspectRatio(); @@ -1806,63 +1806,6 @@ void DrawCrosshair(PLAYERp pp) if (dimensionmode == 6) return; -// wdx = 160; -// wdy = 100; -#if 0 - if (cl_autoaim) - { - int daz; - short hit_sprite, daang; - static int handle=-1; - - daz = pp->posz + pp->bob_z; - daang = 32; - if ((hit_sprite = WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, FALSE)) != -1) - { - SPRITEp hp = &sprite[hit_sprite]; - USERp hu = User[hit_sprite]; - vec2_t const zero = { 0, 0 }; - - // Find the delta coordinates from player to monster that is targeted - vec2_t dxy = { hp->x - pp->posx, hp->y - pp->posy }; - int dz = ((hp->z - (SPRITE_SIZE_Z(hit_sprite)/2)) - pp->posz) >> 4; - - rotatepoint(zero, dxy, (-pp->pang)&2047, &dxy); - - if (dxy.x == 0) return; - - wdx = windowxy1.x + ((windowxy2.x-windowxy1.x)/2); - wdy = windowxy1.y + ((windowxy2.y-windowxy1.y)/2); - - x = (dxy.y * wdx << 8) / dxy.x + (wdx << 8); - y = (dz * wdx << 8) / dxy.x + (wdy << 8); - - y -= 100; - y += (pp->horiz*wdx)/160; - - if (pp->CurWpn == pp->Wpn[WPN_RAIL]) - { - if (!FX_SoundActive(handle)) - handle = PlaySound(DIGI_RAILLOCKED, &pp->posx, &pp->posy, &pp->posz, v3df_follow|v3df_dontpan); - } - } - else - { - // It didn't target anything. - if (pp->CurWpn == pp->Wpn[WPN_RAIL]) - { - if (FX_SoundActive(handle)) - FX_StopSound(handle); - } - goto NORMALXHAIR; - } - - rotatesprite(x << 8, y << 8, (1 << 16), 0, - 2326, 10, 0, - ROTATE_SPRITE_VIEW_CLIP|ROTATE_SPRITE_CORNER, 0, 0, xdim - 1, ydim - 1); - } - else -#endif { //NORMALXHAIR: rotatesprite(CrosshairX, CrosshairY, (1 << 16), 0, @@ -2234,6 +2177,7 @@ short ScreenSavePic = FALSE; SWBOOL PicInView(short, SWBOOL); void DoPlayerDiveMeter(PLAYERp pp); +void MoveScrollMode2D(PLAYERp pp); void drawscreen(PLAYERp pp) @@ -2272,13 +2216,13 @@ drawscreen(PLAYERp pp) { #define TEN_PIC 5109 - flushperms(); + renderFlushPerms(); // note - could put Order Info Pages at the top like this also rotatesprite(0,0,65536L,0,TEN_PIC,0,0, (ROTATE_SPRITE_CORNER|ROTATE_SPRITE_SCREEN_CLIP|ROTATE_SPRITE_NON_MASK|ROTATE_SPRITE_IGNORE_START_MOST), 0, 0, xdim-1, ydim-1); - nextpage(); + videoNextPage(); return; } #endif @@ -2471,7 +2415,6 @@ drawscreen(PLAYERp pp) if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex) { - void MoveScrollMode2D(PLAYERp pp); extern SWBOOL ScrollMode2D; if (ScrollMode2D) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index b8a041af7..feb5f58f6 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -102,7 +102,7 @@ BEGIN_SW_NS void pClearSpriteList(PLAYERp pp); signed char MNU_InputSmallString(char*, short); signed char MNU_InputString(char*, short); -SWBOOL IsCommand(char* str); +SWBOOL IsCommand(const char* str); SWBOOL MNU_StartNetGame(void); const char* AppProperName = "VoidSW"; @@ -245,7 +245,7 @@ extern int bufferjitter; SWBOOL CameraTestMode = FALSE; -char ds[512]; // debug string +char ds[645]; // debug string extern short NormalVisibility; @@ -366,37 +366,6 @@ int krand1(void) #endif -/* -void HeapCheck(char *file, int line) -{ - switch( _heapchk() ) - { - case _HEAPOK: - //printf( "OK - heap is good\n" ); - break; - case _HEAPEMPTY: - //printf( "OK - heap is empty\n" ); - break; - case _HEAPBADBEGIN: - sprintf(ds, "ERROR - heap is damaged: %s, %d", file, line); - MONO_PRINT(ds); - DebugWriteString(ds); - setvmode(0x3); - printf( "%s\n", ds); - exit(0); - break; - case _HEAPBADNODE: - sprintf(ds, "ERROR - bad node in heap: %s, %d", file, line); - MONO_PRINT(ds); - DebugWriteString(ds); - setvmode(0x3); - printf( "%s\n", ds); - exit(0); - break; - } -} - */ - #if DEBUG SWBOOL ValidPtr(void *ptr) @@ -645,8 +614,7 @@ setup2dscreen(void) -void -TerminateGame(void) +void TerminateGame(void) { int i,j; int oldtotalclock; @@ -675,8 +643,7 @@ TerminateGame(void) } -void -LoadLevel(const char *filename) +void LoadLevel(const char *filename) { int pos; @@ -840,8 +807,7 @@ static void SW_FatalEngineError(void) I_Error("There was a problem initialising the Build engine: %s", engineerrstr); } -void -InitGame() +void InitGame() { extern int MovesPerPacket; //void *ReserveMem=NULL; @@ -935,7 +901,7 @@ InitGame() // LoadImages will now proceed to steal all the remaining heap space //_outtext("\n\n\n\n\n\n\n\n"); //AnimateCacheCursor(); - buildputs("Loading sound and graphics...\n"); + initprintf("Loading sound and graphics...\n"); TileFiles.LoadArtSet("tiles%03d.art"); // Now free it up for later use @@ -1067,22 +1033,41 @@ LEVEL_INFO LevelInfo[MAX_LEVELS+2] = // Shareware }; #endif*/ -char EpisodeNames[2][MAX_EPISODE_NAME_LEN+2] = +const char *ThemeSongs[6] = { - "^Enter the Wang", - "^Code of Honor" + "THEME.MID", + "ENDLEV3.VOC", + "SERPENT.MID", + "SUMO.MID", + "ZILLA.MID" + "ENDING.MID" }; -char EpisodeSubtitles[2][MAX_EPISODE_SUBTITLE_LEN+1] = + +int ThemeTrack[6] = { - "Four levels (Shareware Version)", - "Eighteen levels (Full Version Only)" + 2,3,13,13,13,14 }; + +char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2] = +{ + "^Enter the Wang", + "^Code of Honor", + "^User Maps", +}; + +char EpisodeSubtitles[3][MAX_EPISODE_SUBTITLE_LEN+1] = +{ + "Four levels (Shareware Version)", + "Eighteen levels (Full Version Only)", + "Select a user map to play", +}; + char SkillNames[4][MAX_SKILL_NAME_LEN+2] = { - "^Tiny grasshopper", - "^I Have No Fear", - "^Who Wants Wang", - "^No Pain, No Gain" + "^Tiny grasshopper", + "^I Have No Fear", + "^Who Wants Wang", + "^No Pain, No Gain" }; void InitNewGame(void) @@ -1502,8 +1487,7 @@ TerminateLevel(void) //HEAP_CHECK(); } -void -NewLevel(void) +void NewLevel(void) { DSPRINTF(ds,"NewLevel"); @@ -1590,8 +1574,8 @@ ResetKeys(void) inputState.ClearAllKeyStatus(); } -SWBOOL -KeyPressed(void) + +SWBOOL KeyPressed(void) { int i; @@ -1604,8 +1588,7 @@ KeyPressed(void) return FALSE; } -uint8_t* -KeyPressedRange(uint8_t* kb, uint8_t* ke) +uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke) { uint8_t* k; @@ -1618,8 +1601,7 @@ KeyPressedRange(uint8_t* kb, uint8_t* ke) return NULL; } -void -ResetKeyRange(uint8_t* kb, uint8_t* ke) +void ResetKeyRange(uint8_t* kb, uint8_t* ke) { uint8_t* k; @@ -1639,8 +1621,7 @@ void PlayTheme() MONO_PRINT(ds); } -void -LogoLevel(void) +void LogoLevel(void) { char called; int fin; @@ -1713,8 +1694,7 @@ LogoLevel(void) } -void -CreditsLevel(void) +void CreditsLevel(void) { char called; int fin; @@ -1804,8 +1784,7 @@ CreditsLevel(void) } -void -SybexScreen(void) +void SybexScreen(void) { if (!SW_SHAREWARE) return; @@ -1819,75 +1798,6 @@ SybexScreen(void) while (!KeyPressed() && !quitevent) handleevents(); } -// CTW REMOVED -/* -void -TenScreen(void) - { - char called; - int fin; - char backup_pal[256*3]; - char pal[PAL_SIZE]; - char tempbuf[256]; - char *palook_bak = palookup[0]; - int i; - uint32_t bak; - int bakready2send; - - if (CommEnabled) - return; - - bak = totalclock; - - flushperms(); - clearview(0); - nextpage(); - - for (i = 0; i < 256; i++) - tempbuf[i] = i; - palookup[0] = tempbuf; - - GetPaletteFromVESA(pal); - memcpy(backup_pal, pal, PAL_SIZE); - - if ((fin = k open4load("ten.pal", 0)) != -1) - { - k read(fin, pal, PAL_SIZE); - k close(fin); - } - - // palette to black - FadeOut(0, 0); - bakready2send = ready2send; - //totalclock = 0; - //ototalclock = 0; - - flushperms(); - // draw it - rotatesprite(0, 0, RS_SCALE, 0, TEN_PIC, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1); - // bring to the front - still back palette - nextpage(); - // set pal - SetPaletteToVESA(pal); - //FadeIn(0, 3); - ResetKeys(); - - while (!KeyPressed()); - - palookup[0] = palook_bak; - - clearview(0); - nextpage(); - SetPaletteToVESA(backup_pal); - - // put up a blank screen while loading - clearview(0); - nextpage(); - - ready2send = bakready2send; - totalclock = bak; - } -*/ // CTW REMOVED END void @@ -1983,16 +1893,14 @@ void DrawLoadLevelScreen(void) short PlayerQuitMenuLevel = -1; -void -IntroAnimLevel(void) +void IntroAnimLevel(void) { DSPRINTF(ds,"IntroAnimLevel"); MONO_PRINT(ds); playanm(0); } -void -MenuLevel(void) +void MenuLevel(void) { char called; int fin; @@ -2001,35 +1909,6 @@ MenuLevel(void) DSPRINTF(ds,"MenuLevel..."); MONO_PRINT(ds); - if (AutoNet) - { - DrawMenuLevelScreen(); - - if (CommEnabled) - { - sprintf(ds,"Lo Wang is waiting for other players..."); - MNU_MeasureString(ds, &w, &h); - MNU_DrawString(TEXT_TEST_COL(w), 170, ds, 1, 16); - - sprintf(ds,"They are afraid!"); - MNU_MeasureString(ds, &w, &h); - MNU_DrawString(TEXT_TEST_COL(w), 180, ds, 1, 16); - } - - videoNextPage(); - - waitforeverybody(); - FirstTimeIntoGame = TRUE; - MNU_StartNetGame(); - FirstTimeIntoGame = FALSE; - waitforeverybody(); - ExitLevel = FALSE; - FinishedLevel = FALSE; - BorderAdjust = TRUE; - UsingMenus = FALSE; - InMenuLevel = FALSE; - return; - } // do demos only if not playing multi play if (!CommEnabled && numplayers <= 1 && !FinishAnim && !NoDemoStartup) @@ -2173,8 +2052,7 @@ MenuLevel(void) videoNextPage(); } -void -SceneLevel(void) +void SceneLevel(void) { SWBOOL dp_bak; SWBOOL dm_bak; @@ -2204,8 +2082,7 @@ SceneLevel(void) DemoPlaying = dp_bak; } -void -LoadingLevelScreen(char *level_name) +void LoadingLevelScreen(char *level_name) { short w,h; extern SWBOOL DemoMode; @@ -2231,8 +2108,7 @@ LoadingLevelScreen(char *level_name) videoNextPage(); } -void -gNextState(STATEp *State) +void gNextState(STATEp *State) { // Transition to the next state *State = (*State)->NextState; @@ -2245,8 +2121,7 @@ gNextState(STATEp *State) } // Generic state control -void -gStateControl(STATEp *State, int *tics) +void gStateControl(STATEp *State, int *tics) { *tics += synctics; @@ -2284,8 +2159,7 @@ int BonusGrabSound(short SpriteNum) return 0; } -void -BonusScreen(PLAYERp pp) +void BonusScreen(PLAYERp pp) { int minutes,seconds,second_tics; extern SWBOOL FinishedLevel; @@ -2563,8 +2437,7 @@ void EndGameSequence(void) } } -void -StatScreen(PLAYERp mpp) +void StatScreen(PLAYERp mpp) { int minutes,seconds,second_tics; extern SWBOOL FinishedLevel; @@ -2745,8 +2618,7 @@ StatScreen(PLAYERp mpp) Terminate3DSounds(); } -void -GameIntro(void) +void GameIntro(void) { DSPRINTF(ds,"GameIntro..."); @@ -2779,8 +2651,7 @@ GameIntro(void) MenuLevel(); } -void -Control() +void Control() { InitGame(); @@ -2788,7 +2659,6 @@ Control() MNU_InitMenus(); InGame = TRUE; GameIntro(); - //NewGame = TRUE; while (!QuitFlag) { @@ -2805,8 +2675,7 @@ Control() } -void -_Assert(const char *expr, const char *strFile, unsigned uLine) +void _Assert(const char *expr, const char *strFile, unsigned uLine) { sprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine); MONO_PRINT(ds); @@ -2820,8 +2689,7 @@ _Assert(const char *expr, const char *strFile, unsigned uLine) } -void -_ErrMsg(const char *strFile, unsigned uLine, const char *format, ...) +void _ErrMsg(const char *strFile, unsigned uLine, const char *format, ...) { va_list arglist; @@ -2850,8 +2718,7 @@ _ErrMsg(const char *strFile, unsigned uLine, const char *format, ...) exit(0); } -void -dsprintf(char *str, char *format, ...) +void dsprintf(char *str, const char *format, ...) { va_list arglist; @@ -2860,8 +2727,7 @@ dsprintf(char *str, char *format, ...) va_end(arglist); } -void -dsprintf_null(char *str, const char *format, ...) +void dsprintf_null(char *str, const char *format, ...) { va_list arglist; } @@ -3033,8 +2899,7 @@ void InitRunLevel(void) StartAmbientSound(); } -void -RunLevel(void) +void RunLevel(void) { int i; InitRunLevel(); @@ -3087,7 +2952,7 @@ void DosScreen(void) void AlphaMessage(void) { Global_PLock = TRUE; // Set the hardwired parental lock mode! - buildputs("" + initprintf("" " SHADOW WARRIOR(tm) Version 1.2 \n" "Copyright (c) 1997 3D Realms Entertainment\n" "\n\n" @@ -3103,7 +2968,7 @@ void AlphaMessage(void) #if 0 //UK_VERSION void AlphaMessage(void) { - buildputs("" + initprintf("" " SHADOW WARRIOR(tm) Version 1.2 (UK Version) \n" "Copyright (c) 1997 3D Realms Entertainment\n" "\n\n" @@ -3118,15 +2983,15 @@ void AlphaMessage(void) #if 1 //!UK_VERSION && !PLOCK_VERSION void AlphaMessage(void) { - if (SW_SHAREWARE) - { - buildputs("SHADOW WARRIOR(tm) Version 1.2 (Shareware Version)\n"); + if (SW_SHAREWARE) + { + initprintf("SHADOW WARRIOR(tm) Version 1.2 (Shareware Version)\n"); + } + else + { + initprintf("SHADOW WARRIOR(tm) Version 1.2\n"); } - else - { - buildputs("SHADOW WARRIOR(tm) Version 1.2\n"); - } - buildputs("Copyright (c) 1997 3D Realms Entertainment\n\n\n"); + initprintf("Copyright (c) 1997 3D Realms Entertainment\n\n"); } #endif @@ -3194,18 +3059,18 @@ CLI_ARG cli_arg[] = }; #if 0 -Map->User Map Name -Auto->Auto Start Game -Rules->0=WangBang 1=WangBang(No Respawn) 2=CoOperative - Level->0 to 24 (?) - Enemy->0=None 1=Easy 2=Norm 3=Hard 4=Insane - Markers->0=Off 1=On - Team->0=Off 1=On - HurtTeam->0=Off 1=On - KillLimit->0=Infinite 1=10 2=20 3=30 4=40 5=50 6=60 7=70 8=80 9=90 10=100 - TimeLimit->0=Infinite 1=3 2=5 3=10 4=20 5=30 6=45 7=60 - Color->0=Brown 1=Purple 2=Red 3=Yellow 4=Olive 5=Green - Nuke->0=Off 1=On +Map -> User Map Name +Auto -> Auto Start Game +Rules -> 0=WangBang 1=WangBang (No Respawn) 2=CoOperative +Level -> 0 to 24(?) +Enemy -> 0=None 1=Easy 2=Norm 3=Hard 4=Insane +Markers -> 0=Off 1=On +Team -> 0=Off 1=On +HurtTeam -> 0=Off 1=On +KillLimit -> 0=Infinite 1=10 2=20 3=30 4=40 5=50 6=60 7=70 8=80 9=90 10=100 +TimeLimit -> 0=Infinite 1=3 2=5 3=10 4=20 5=30 6=45 7=60 +Color -> 0=Brown 1=Purple 2=Red 3=Yellow 4=Olive 5=Green +Nuke -> 0=Off 1=On Example Command Line : sw -map testmap.map -autonet 0,0,1,1,1,0,3,2,1,1 -f4 -name 1234567890 -net 12345678 @@ -3239,49 +3104,6 @@ int DetectShareware(void) void CommandLineHelp(char const * const * argv) { - int i; -#ifdef RENDERTYPEWIN - char *str; - int strl; - - strl = 30 + 70; - for (i=0; i < (int)SIZ(cli_arg); i++) - if (cli_arg[i].arg_fmt && (!SW_SHAREWARE || (!cli_arg[i].notshareware && SW_SHAREWARE))) - strl += strlen(cli_arg[i].arg_fmt) + 1 + strlen(cli_arg[i].arg_descr) + 1; - - str = (char *)malloc(strl); - if (str) - { - strcpy(str,"Usage: sw [options]\n"); - strcat(str,"options: ('/' may be used instead of '-', <> text is optional)\n\n"); - for (i=0; i < (int)SIZ(cli_arg); i++) - { - if (cli_arg[i].arg_fmt && (!SW_SHAREWARE || (!cli_arg[i].notshareware && SW_SHAREWARE))) - { - strcat(str, cli_arg[i].arg_fmt); - strcat(str, "\t"); - strcat(str, cli_arg[i].arg_descr); - strcat(str, "\n"); - } - } - wm_msgbox("Shadow Warrior Help",str); - free(str); - } -#else - if (SW_SHAREWARE) - printf("Usage: %s [options]\n", argv[0]); - else - printf("Usage: %s [options] [map]\n", argv[0]); - printf("options: ('/' may be used instead of '-', <> text is optional)\n\n"); - - for (i = 0; i < (int)SIZ(cli_arg); i++) - { - if (cli_arg[i].arg_fmt && (!SW_SHAREWARE || (!cli_arg[i].notshareware && SW_SHAREWARE))) - { - printf(" %-20s %-30s\n",cli_arg[i].arg_fmt, cli_arg[i].arg_descr); - } - } -#endif } int32_t GameInterface::app_main() @@ -3333,8 +3155,7 @@ int32_t GameInterface::app_main() return 0; } -void -ManualPlayerInsert(PLAYERp pp) +void ManualPlayerInsert(PLAYERp pp) { PLAYERp npp = Player + numplayers; int i; @@ -3365,8 +3186,7 @@ ManualPlayerInsert(PLAYERp pp) } -void -BotPlayerInsert(PLAYERp pp) +void BotPlayerInsert(PLAYERp pp) { PLAYERp npp = Player + numplayers; int i; @@ -3398,8 +3218,7 @@ BotPlayerInsert(PLAYERp pp) // SetFragBar(pp); } -void -ManualPlayerDelete(PLAYERp cur_pp) +void ManualPlayerDelete(PLAYERp cur_pp) { short i, nexti; USERp u; @@ -3433,8 +3252,7 @@ ManualPlayerDelete(PLAYERp cur_pp) } #if DEBUG -void -SinglePlayInput(PLAYERp pp) +void SinglePlayInput(PLAYERp pp) { int pnum = myconnectindex; uint8_t* kp; @@ -3470,8 +3288,7 @@ SinglePlayInput(PLAYERp pp) } -void -DebugKeys(PLAYERp pp) +void DebugKeys(PLAYERp pp) { short w, h; @@ -3539,8 +3356,7 @@ DebugKeys(PLAYERp pp) #endif -void -ConKey(void) +void ConKey(void) { #if DEBUG // Console Input Panel @@ -3580,8 +3396,7 @@ ConKey(void) #endif } -void -FunctionKeys(PLAYERp pp) +void FunctionKeys(PLAYERp pp) { extern SWBOOL GamePaused; extern short QuickLoadNum; @@ -4116,8 +3931,7 @@ void GetHelpInput(PLAYERp pp) short MirrorDelay; int MouseYAxisMode = -1; -void -getinput(SW_PACKET *loc) +void getinput(SW_PACKET *loc) { SWBOOL found = FALSE; int i; @@ -4652,7 +4466,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang) continue; if (sector[i].floorshade != sector[wal->nextsector].floorshade) continue; - col = 12; + col = 12; // 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple } ox = wal->x - cposx; @@ -4691,7 +4505,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang) SHOWSPRITE: spr = &sprite[j]; - col = 56; + col = 56; // 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple if ((spr->cstat & 1) > 0) col = 248; if (j == k) @@ -4908,8 +4722,7 @@ SHOWSPRITE: #if RANDOM_DEBUG -int -RandomRange(int range, char *file, unsigned line) +int RandomRange(int range, char *file, unsigned line) { uint32_t rand_num; uint32_t value; @@ -4939,8 +4752,7 @@ RandomRange(int range, char *file, unsigned line) return value; } #else -int -RandomRange(int range) +int RandomRange(int range) { uint32_t rand_num; uint32_t value; @@ -4963,8 +4775,7 @@ RandomRange(int range) } #endif -int -StdRandomRange(int range) +int StdRandomRange(int range) { uint32_t rand_num; uint32_t value; @@ -5030,5 +4841,4 @@ bool GameInterface::mouseInactiveConditional(bool condition) } -// vim:ts=4:sw=4:expandtab: END_SW_NS diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 7f6b65ba3..91bc55d55 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -383,7 +383,7 @@ extern char MessageOutputString[256]; #define TRAVERSE_SPRITE_SECT(l, o, n) for ((o) = (l); (n) = nextspritesect[o], (o) != -1; (o) = (n)) #define TRAVERSE_SPRITE_STAT(l, o, n) for ((o) = (l); (n) = nextspritestat[o], (o) != -1; (o) = (n)) -#define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1 && i != connectpoint2[i]; i = connectpoint2[i]) +#define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i]) #define NORM_ANGLE(ang) ((ang) & 2047) @@ -853,7 +853,7 @@ int minitextshade(int x,int y,char *t,char s,char p,char sb); void operatefta(void); void adduserquote(const char *daquote); void operateconfta(void); -void addconquote(char *daquote); +void addconquote(const char *daquote); /////////////////////////////////////////////////////////////////////////////////////////// // @@ -962,12 +962,14 @@ typedef struct } LEVEL_INFO, *LEVEL_INFOp, * *LEVEL_INFOpp; extern LEVEL_INFO LevelInfo[MAX_LEVELS_REG+2]; +extern int ThemeTrack[6]; // w +extern const char *ThemeSongs[6]; // #define MAX_EPISODE_NAME_LEN 24 -extern char EpisodeNames[2][MAX_EPISODE_NAME_LEN+2]; // +2 = leading '^' and trailing NULL +extern char EpisodeNames[3][MAX_EPISODE_NAME_LEN+2]; #define MAX_EPISODE_SUBTITLE_LEN 40 -extern char EpisodeSubtitles[2][MAX_EPISODE_SUBTITLE_LEN+1]; +extern char EpisodeSubtitles[3][MAX_EPISODE_SUBTITLE_LEN+1]; #define MAX_SKILL_NAME_LEN 24 extern char SkillNames[4][MAX_SKILL_NAME_LEN+2]; @@ -2326,7 +2328,7 @@ void LoadKVXFromScript(const char *filename); // scrip2.c void LoadPLockFromScript(const char *filename); // scrip2.c void LoadCustomInfoFromScript(const char *filename); // scrip2.c -void EveryCheatToggle(PLAYERp pp,char *cheat_string); // cheats.c +void EveryCheatToggle(PLAYERp pp,const char *cheat_string); // cheats.c int PlayerInitChemBomb(PLAYERp pp); // jweapon.c int PlayerInitFlashBomb(PLAYERp pp); // jweapon.c diff --git a/source/sw/src/hornet.cpp b/source/sw/src/hornet.cpp index 179d9ecfa..cf2f77eff 100644 --- a/source/sw/src/hornet.cpp +++ b/source/sw/src/hornet.cpp @@ -354,10 +354,10 @@ int DoHornetMatchPlayerZ(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; SPRITEp tsp = User[SpriteNum]->tgt_sp; - long zdiff,zdist; - long loz,hiz; - - long bound; + int zdiff,zdist; + int loz,hiz; + + int bound; // actor does a sine wave about u->sz - this is the z mid point @@ -408,11 +408,11 @@ int DoHornetMatchPlayerZ(short SpriteNum) u->sz = bound; } - u->sz = min(long(u->sz), long(loz - u->floor_dist)); - u->sz = max(long(u->sz), long(hiz + u->ceiling_dist)); + u->sz = min(u->sz, loz - u->floor_dist); + u->sz = max(u->sz, hiz + u->ceiling_dist); u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; - sp->z = u->sz + ((HORNET_BOB_AMT * (long)sintable[u->Counter]) >> 14); + sp->z = u->sz + ((HORNET_BOB_AMT * (int)sintable[u->Counter]) >> 14); bound = u->hiz + u->ceiling_dist + HORNET_BOB_AMT; if (sp->z < bound) @@ -461,12 +461,12 @@ int DoHornetCircle(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; SPRITEp tsp = User[SpriteNum]->tgt_sp; - long nx,ny,bound; + int nx,ny,bound; sp->ang = NORM_ANGLE(sp->ang + u->Counter2); - nx = sp->xvel * (long) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; - ny = sp->xvel * (long) sintable[sp->ang] >> 14; + nx = sp->xvel * (int) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; + ny = sp->xvel * (int) sintable[sp->ang] >> 14; if (!move_actor(SpriteNum, nx, ny, 0L)) { @@ -475,8 +475,8 @@ int DoHornetCircle(short SpriteNum) // try moving in the opposite direction u->Counter2 = -u->Counter2; sp->ang = NORM_ANGLE(sp->ang + 1024); - nx = sp->xvel * (long) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; - ny = sp->xvel * (long) sintable[sp->ang] >> 14; + nx = sp->xvel * (int) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; + ny = sp->xvel * (int) sintable[sp->ang] >> 14; if (!move_actor(SpriteNum, nx, ny, 0L)) { @@ -514,7 +514,7 @@ DoHornetDeath(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - long nx, ny; + int nx, ny; if (TEST(u->Flags, SPR_FALLING)) { @@ -535,8 +535,8 @@ DoHornetDeath(short SpriteNum) DoActorSlide(SpriteNum); // slide while falling - nx = sp->xvel * (long) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; - ny = sp->xvel * (long) sintable[sp->ang] >> 14; + nx = sp->xvel * (int) sintable[NORM_ANGLE(sp->ang + 512)] >> 14; + ny = sp->xvel * (int) sintable[sp->ang] >> 14; u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, 1, ACTORMOVETICS); @@ -559,7 +559,7 @@ int DoCheckSwarm(short SpriteNum) short i,nexti; SPRITEp sp = &sprite[SpriteNum], tsp; USERp u = User[SpriteNum], tu; - long dist, pdist, a,b,c; + int dist, pdist, a,b,c; PLAYERp pp; if (!MoveSkip8) return 0; // Don't over check diff --git a/source/sw/src/inv.cpp b/source/sw/src/inv.cpp index 66d77409c..157d51174 100644 --- a/source/sw/src/inv.cpp +++ b/source/sw/src/inv.cpp @@ -180,8 +180,7 @@ void UpdateMiniBar(PLAYERp pp) } -void -PanelInvTestSuicide(PANEL_SPRITEp psp) +void PanelInvTestSuicide(PANEL_SPRITEp psp) { if (TEST(psp->flags, PANF_SUICIDE)) { @@ -189,8 +188,7 @@ PanelInvTestSuicide(PANEL_SPRITEp psp) } } -PANEL_SPRITEp -SpawnInventoryIcon(PLAYERp pp, short InventoryNum) +PANEL_SPRITEp SpawnInventoryIcon(PLAYERp pp, short InventoryNum) { PANEL_SPRITEp psp; short x,y; @@ -221,8 +219,7 @@ SpawnInventoryIcon(PLAYERp pp, short InventoryNum) return psp; } -void -KillPanelInv(PLAYERp pp, short InventoryNum) +void KillPanelInv(PLAYERp pp, short InventoryNum) { ASSERT(pp->InventorySprite[InventoryNum]); ASSERT(InventoryNum < MAX_INVENTORY); @@ -232,15 +229,13 @@ KillPanelInv(PLAYERp pp, short InventoryNum) pp->InventorySprite[InventoryNum] = NULL; } -void -KillPlayerIcon(PLAYERp pp, PANEL_SPRITEp *pspp) +void KillPlayerIcon(PLAYERp pp, PANEL_SPRITEp *pspp) { SET((*pspp)->flags, PANF_SUICIDE); (*pspp) = NULL; } -void -KillAllPanelInv(PLAYERp pp) +void KillAllPanelInv(PLAYERp pp) { short i; @@ -256,8 +251,7 @@ KillAllPanelInv(PLAYERp pp) } } -PANEL_SPRITEp -SpawnIcon(PLAYERp pp, PANEL_STATEp state) +PANEL_SPRITEp SpawnIcon(PLAYERp pp, PANEL_STATEp state) { PANEL_SPRITEp psp; short i; @@ -304,8 +298,7 @@ void AutoPickInventory(PLAYERp pp) } } -void -UseInventoryMedkit(PLAYERp pp) +void UseInventoryMedkit(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short diff; @@ -353,8 +346,7 @@ UseInventoryMedkit(PLAYERp pp) // CHEMICAL WARFARE CANISTERS // ////////////////////////////////////////////////////////////////////// -void -UseInventoryChemBomb(PLAYERp pp) +void UseInventoryChemBomb(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short diff; @@ -379,8 +371,7 @@ UseInventoryChemBomb(PLAYERp pp) // FLASH BOMBS // ////////////////////////////////////////////////////////////////////// -void -UseInventoryFlashBomb(PLAYERp pp) +void UseInventoryFlashBomb(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short diff; @@ -405,8 +396,7 @@ UseInventoryFlashBomb(PLAYERp pp) // CALTROPS // ////////////////////////////////////////////////////////////////////// -void -UseInventoryCaltrops(PLAYERp pp) +void UseInventoryCaltrops(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short diff; @@ -432,8 +422,7 @@ UseInventoryCaltrops(PLAYERp pp) // ////////////////////////////////////////////////////////////////////// -void -UseInventoryRepairKit(PLAYERp pp) +void UseInventoryRepairKit(PLAYERp pp) { SPRITEp sp = pp->SpriteP; short inv = INVENTORY_REPAIR_KIT; @@ -462,8 +451,7 @@ UseInventoryRepairKit(PLAYERp pp) // ////////////////////////////////////////////////////////////////////// -void -UseInventoryCloak(PLAYERp pp) +void UseInventoryCloak(PLAYERp pp) { SPRITEp sp = pp->SpriteP; @@ -489,8 +477,7 @@ UseInventoryCloak(PLAYERp pp) PlayerSound(DIGI_IAMSHADOW,&pp->posx,&pp->posy,&pp->posz,v3df_follow|v3df_dontpan,pp); } -void -StopInventoryCloak(PLAYERp pp, short InventoryNum) +void StopInventoryCloak(PLAYERp pp, short InventoryNum) { SPRITEp sp = pp->SpriteP; @@ -518,8 +505,7 @@ StopInventoryCloak(PLAYERp pp, short InventoryNum) // ////////////////////////////////////////////////////////////////////// #if 0 -void -UseInventoryEnvironSuit(PLAYERp pp) +void UseInventoryEnvironSuit(PLAYERp pp) { SPRITEp sp = pp->SpriteP; short inv = INVENTORY_ENVIRON_SUIT; @@ -533,8 +519,7 @@ UseInventoryEnvironSuit(PLAYERp pp) } } -void -StopInventoryEnvironSuit(PLAYERp pp, short InventoryNum) +void StopInventoryEnvironSuit(PLAYERp pp, short InventoryNum) { SPRITEp sp = pp->SpriteP; short inv = INVENTORY_ENVIRON_SUIT; @@ -908,7 +893,7 @@ void InventoryBarUpdatePosition(PLAYERp pp) pp->InventorySelectionBox->x = x - 5; pp->InventorySelectionBox->y = y - 5; - for (id = InventoryData; id->Name; id++, inv++) + for (id = InventoryData; id->Name && inv < MAX_INVENTORY; id++, inv++) { x = InventoryBarXpos[gs.BorderNum] + (inv * INVENTORY_ICON_WIDTH); y = InventoryBarYpos[gs.BorderNum]; @@ -960,8 +945,7 @@ void (*InventoryDisplayString)(PLAYERp, short, short, short, const char *); #define INVENTORY_STATE_XOFF 19 #define INVENTORY_STATE_YOFF 1 -void -PlayerUpdateInventory(PLAYERp pp, short InventoryNum) +void PlayerUpdateInventory(PLAYERp pp, short InventoryNum) { USERp u = User[pp->PlayerSprite]; short w,h; @@ -974,9 +958,13 @@ PlayerUpdateInventory(PLAYERp pp, short InventoryNum) PANEL_SPRITEp psp; // Go translucent if used - for (id = InventoryData; id->Name; id++, inv++) + for (id = InventoryData; id->Name && inv < MAX_INVENTORY; id++, inv++) { psp = pp->InventorySprite[inv]; + + if (!psp) + continue; + if (!pp->InventoryAmount[inv]) { //SET(psp->flags, PANF_TRANSLUCENT); @@ -1043,8 +1031,7 @@ PlayerUpdateInventory(PLAYERp pp, short InventoryNum) } } -void -PlayerUpdateInventoryPercent(PLAYERp pp) +void PlayerUpdateInventoryPercent(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -1065,8 +1052,7 @@ PlayerUpdateInventoryPercent(PLAYERp pp) } } -void -PlayerUpdateInventoryPic(PLAYERp pp) +void PlayerUpdateInventoryPic(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; PANEL_SPRITEp psp; @@ -1084,8 +1070,7 @@ PlayerUpdateInventoryPic(PLAYERp pp) psp->scale = id->Scale; } -void -PlayerUpdateInventoryState(PLAYERp pp) +void PlayerUpdateInventoryState(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short x,y; diff --git a/source/sw/src/inv.h b/source/sw/src/inv.h index 3d35b2d8a..0d9ba6722 100644 --- a/source/sw/src/inv.h +++ b/source/sw/src/inv.h @@ -44,7 +44,7 @@ typedef struct PANEL_STATEp State; short DecPerSec; short MaxInv; - long Scale; + int Scale; short Flags; } INVENTORY_DATA, *INVENTORY_DATAp; diff --git a/source/sw/src/jplayer.cpp b/source/sw/src/jplayer.cpp index 832168c11..04a9aac35 100644 --- a/source/sw/src/jplayer.cpp +++ b/source/sw/src/jplayer.cpp @@ -276,7 +276,7 @@ void operatefta(void) int conbot, conbotgoal; char con_quote[MAXCONQUOTES][256]; -void addconquote(char *daquote) +void addconquote(const char *daquote) { int i; diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 66c351aa6..8509d3ee0 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -78,8 +78,7 @@ extern ParentalStruct aVoxelArray[MAXTILES]; ///////////////////////////////////////////////////// // SpawnWallSound ///////////////////////////////////////////////////// -void -SpawnWallSound(short sndnum, short i) +void SpawnWallSound(short sndnum, short i) { short SpriteNum; vec3_t mid; @@ -315,8 +314,7 @@ JS_SpriteSetup(void) ///////////////////////////////////////////////////// // Initialize the mirrors ///////////////////////////////////////////////////// -void -JS_InitMirrors(void) +void JS_InitMirrors(void) { short startwall, endwall, dasector; int i, j, k, s, dax, day, daz, dax2, day2; @@ -483,7 +481,6 @@ JS_InitMirrors(void) ///////////////////////////////////////////////////// // Draw a 3d screen to a specific tile ///////////////////////////////////////////////////// -#if 1 void drawroomstotile(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum, short tilenume) { @@ -501,94 +498,6 @@ void drawroomstotile(int daposx, int daposy, int daposz, tileInvalidate(tilenume, -1, -1); } -#else -void -drawroomstotile(int daposx, int daposy, int daposz, - short daang, int dahoriz, short dacursectnum, short tilenume) -{ - - int i, j, k, bakchainnumpages, bakvidoption; - intptr_t bakframeplace; - vec2_t bakwindowxy1, bakwindowxy2; - int xsiz, ysiz; - char *ptr1, *ptr2; - - // DRAWROOMS TO TILE BACKUP&SET CODE - xsiz = tilesiz[tilenume].x; - ysiz = tilesiz[tilenume].y; - // bakchainnumpages = chainnumpages; - bakchainnumpages = numpages; - // chainnumpages = 0; - numpages = 0; - bakvidoption = vidoption; - vidoption = 1; - if (waloff[tilenume] == 0) - loadtile(tilenume); - bakframeplace = frameplace; - frameplace = waloff[tilenume]; - bakwindowxy1 = windowxy1; - bakwindowxy2 = windowxy2; - setview(0, 0, xsiz - 1, ysiz - 1); - setvlinebpl(xsiz); - j = 0; - for (i = 0; i <= ysiz; i++) - { - ylookup[i] = j, j += xsiz; - } - - // DRAWS TO TILE HERE - drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum + MAXSECTORS); - analyzesprites(daposx, daposy, daposz, FALSE); - renderDrawMasks(); - - setviewback(); - - // ROTATE TILE (supports square tiles only for rotation part) - if (xsiz == ysiz) - { - k = (xsiz << 1); - for (i = xsiz - 1; i >= 0; i--) - { - ptr1 = (char *)(waloff[tilenume] + i * (xsiz + 1)); - ptr2 = ptr1; - if ((i & 1) != 0) - { - ptr1--; - ptr2 -= xsiz; - swapchar(ptr1, ptr2); - } - for (j = (i >> 1) - 1; j >= 0; j--) - { - ptr1 -= 2; - ptr2 -= k; - swapchar2(ptr1, ptr2, xsiz); - // swapchar(ptr1,ptr2); - // swapchar(ptr1+1,ptr2+xsiz); - } - } - } - - // DRAWROOMS TO TILE RESTORE CODE - setview(bakwindowxy1.x, bakwindowxy1.y, bakwindowxy2.x, bakwindowxy2.y); - // chainnumpages = bakchainnumpages; - numpages = bakchainnumpages; - vidoption = bakvidoption; - frameplace = bakframeplace; - j = 0; - // if (chainnumpages >= 2) - if (numpages >= 2) - { - for (i = 0; i <= ysiz; i++) - ylookup[i] = j, j += (xdim >> 2); - } - else - { - for (i = 0; i <= ysiz; i++) - ylookup[i] = j, j += xdim; - } - setvlinebpl(ylookup[1]); -} -#endif void JS_ProcessEchoSpot() @@ -648,7 +557,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz) char ch, *ptr, *ptr2, *ptr3, *ptr4; char tvisibility, palok; -// long tx, ty, tz, tpang; // Interpolate so mirror doesn't +// int tx, ty, tz, tpang; // Interpolate so mirror doesn't // drift! SWBOOL bIsWallMirror = FALSE; @@ -1065,8 +974,7 @@ DoAutoSize(uspritetype * tspr) // Rotation angles for sprites short rotang = 0; -void -JAnalyzeSprites(uspritetype * tspr) +void JAnalyzeSprites(uspritetype * tspr) { int i, currsprite; diff --git a/source/sw/src/mdastr.cpp b/source/sw/src/mdastr.cpp deleted file mode 100644 index 14bca4c12..000000000 --- a/source/sw/src/mdastr.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1997, 2005 - 3D Realms Entertainment - -This file is part of Shadow Warrior version 1.2 - -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. - -Original Source: 1997 - Frank Maddin and Jim Norwood -Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- -#include "ns.h" - -#include "build.h" - -#include "mytypes.h" -#include "keys.h" -#include "names2.h" -//#include "panel.h" -#include "game.h" - -BEGIN_SW_NS - -// macros this function needs -//#define MK_FP(seg,ofs) ((void _seg *)(seg)+(void near *)(ofs)) -//#define PokeByte(a,b,c) (*((char far *)MK_FP((a),(b)))=(char)(c)) - -//#if DEBUG -void -PokeStringMono(uint8_t Attr, uint8_t* String) -{ - fprintf(stderr,"MONO: %s\n",String); -#if 0 - // Scrolls the monochrome display up one line, then prints the - // string with the desired attribute on the bottom line. - - // EXAMPLE: PokeStringMono(MDA_NORMAL, "Hello, world."); - - uint8_t* Src, Dest; - int32_t* s,d; - static char MonoBuf[4000]; - -#define BASE (MonoBuf) -#define LINE_SIZE 160 -#define LINE_OFFSET(num) ((80*2)*(num)) - - // First scroll the screen up one line. - // copy lines 1-24 up to 0 - s = (int32_t*)(BASE + LINE_SIZE); - d = (int32_t*)BASE; - memmove(d,s,LINE_OFFSET(24)); - - // clear bottom line - Dest = BASE + LINE_OFFSET(24); - //memset(Dest,0,LINE_SIZE); - memset(Dest,'.',LINE_SIZE); - - // Now print the string on the bottom line. - Src = String; - Dest = BASE + LINE_OFFSET(24); - - while (*Src) - { - *Dest++ = *Src++; - *Dest++ = Attr; - } - - memcpy((char *)0xB0000, MonoBuf, sizeof(MonoBuf)); -#endif -} -//#endif - -END_SW_NS diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 986245085..5642f1e8d 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -1944,8 +1944,7 @@ static char lg_xlat_num[] = {0,1,2,3,4,5,6,7,8,9}; #define FONT_LARGE_ALPHA 3706 #define FONT_LARGE_DIGIT 3732 -void -MNU_MeasureStringLarge(const char *string, short *w, short *h) +void MNU_MeasureStringLarge(const char *string, short *w, short *h) { short ndx, width, height; char c; @@ -1987,8 +1986,7 @@ MNU_MeasureStringLarge(const char *string, short *w, short *h) //////////////////////////////////////////////// // Draw a string using a graphic font //////////////////////////////////////////////// -void -MNU_DrawStringLarge(short x, short y, const char *string) +void MNU_DrawStringLarge(short x, short y, const char *string) { int ndx, offset; char c; @@ -2027,8 +2025,7 @@ MNU_DrawStringLarge(short x, short y, const char *string) //////////////////////////////////////////////// // Measure the pixel width of a graphic string //////////////////////////////////////////////// -void -MNU_MeasureString(const char *string, short *w, short *h) +void MNU_MeasureString(const char *string, short *w, short *h) { short ndx, width, height; char c; @@ -2068,8 +2065,7 @@ MNU_MeasureString(const char *string, short *w, short *h) // // MenuTextShade and MenuDrawFlags //////////////////////////////////////////////// -void -MNU_DrawString(short x, short y, const char *string, short shade, short pal) +void MNU_DrawString(short x, short y, const char *string, short shade, short pal) { int ndx, offset; char c; @@ -2131,8 +2127,7 @@ MNU_DrawString(short x, short y, char *string) //////////////////////////////////////////////// // Measure the pixel width of a small font string //////////////////////////////////////////////// -void -MNU_MeasureSmallString(const char *string, short *w, short *h) +void MNU_MeasureSmallString(const char *string, short *w, short *h) { short ndx, width, height; char c; @@ -2164,8 +2159,7 @@ MNU_MeasureSmallString(const char *string, short *w, short *h) //////////////////////////////////////////////// // Draw a string using a small graphic font //////////////////////////////////////////////// -void -MNU_DrawSmallString(short x, short y, const char *string, short shade, short pal) +void MNU_DrawSmallString(short x, short y, const char *string, short shade, short pal) { int ndx; char c; @@ -2199,8 +2193,7 @@ MNU_DrawSmallString(short x, short y, const char *string, short shade, short pal // Get an input string from user using small font //////////////////////////////////////////////// -signed char -MNU_InputSmallString(char *name, short pix_width) +signed char MNU_InputSmallString(char *name, short pix_width) { char ch; short w, h; @@ -2274,8 +2267,7 @@ MNU_InputSmallString(char *name, short pix_width) //////////////////////////////////////////////// // Draw dialog text on screen //////////////////////////////////////////////// -static SWBOOL -MNU_Dialog(void) +static SWBOOL MNU_Dialog(void) { short ndx, linecnt, w[MAXDIALOG], h, x, y; @@ -2312,8 +2304,7 @@ MNU_Dialog(void) // Get an input string from user //////////////////////////////////////////////// -signed char -MNU_InputString(char *name, short pix_width) +signed char MNU_InputString(char *name, short pix_width) { char ch; short w, h; @@ -2397,8 +2388,7 @@ void LoadSaveMsg(const char *msg) // I'm figuring it need to do the following: // . Load the game if there is one by calling: MNU_LoadGameCustom. //////////////////////////////////////////////// -SWBOOL -MNU_GetLoadCustom(void) +SWBOOL MNU_GetLoadCustom(void) { short load_num; @@ -2464,8 +2454,7 @@ MNU_GetLoadCustom(void) // . Call MNU_GetInput to allow string input of description. // . Save the game if there is one by calling: MNU_SaveGameCustom. //////////////////////////////////////////////// -SWBOOL -MNU_GetSaveCustom(void) +SWBOOL MNU_GetSaveCustom(void) { short save_num; extern SWBOOL InMenuLevel, LoadGameOutsideMoveLoop; @@ -2518,8 +2507,7 @@ MNU_GetSaveCustom(void) // This function gets called each frame by DrawMenus //////////////////////////////////////////////// -static SWBOOL -MNU_DrawLoadSave(short game_num) +static SWBOOL MNU_DrawLoadSave(short game_num) { // screen border rotatesprite(SS_XSTART << 16, SS_YSTART << 16, MZ, 0, pic_loadsavescreen, @@ -2539,8 +2527,8 @@ MNU_DrawLoadSave(short game_num) static char SaveGameInfo1[80]; static char SaveGameInfo2[80]; -SWBOOL -MNU_LoadSaveMove(UserCall call, MenuItem_p item) + +SWBOOL MNU_LoadSaveMove(UserCall call, MenuItem_p item) { short i; short game_num; @@ -2648,8 +2636,7 @@ MNU_LoadSaveMove(UserCall call, MenuItem_p item) return TRUE; } -SWBOOL -MNU_LoadSaveDraw(UserCall call, MenuItem_p item) +SWBOOL MNU_LoadSaveDraw(UserCall call, MenuItem_p item) { short i; short game_num; @@ -2715,8 +2702,7 @@ MNU_LoadSaveDraw(UserCall call, MenuItem_p item) return TRUE; } -SWBOOL -MNU_ShareWareCheck(MenuItem *item) +SWBOOL MNU_ShareWareCheck(MenuItem *item) { if (SW_SHAREWARE) { @@ -2726,8 +2712,7 @@ MNU_ShareWareCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_CheckUserMap(MenuItem *item) +SWBOOL MNU_CheckUserMap(MenuItem *item) { if (UserMapName[0] == '\0') RESET(item->flags, mf_disabled); @@ -2736,8 +2721,7 @@ MNU_CheckUserMap(MenuItem *item) return TRUE; } -SWBOOL -MNU_ShareWareMessage(MenuItem *item) +SWBOOL MNU_ShareWareMessage(MenuItem *item) { const char *extra_text; short w,h; @@ -2767,8 +2751,7 @@ MNU_ShareWareMessage(MenuItem *item) return TRUE; } -SWBOOL -MNU_SaveGameCheck(MenuItem *item) +SWBOOL MNU_SaveGameCheck(MenuItem *item) { extern SWBOOL InMenuLevel; extern SWBOOL DemoMode; @@ -2799,8 +2782,7 @@ MNU_SaveGameCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_TenCheck(MenuItem *item) +SWBOOL MNU_TenCheck(MenuItem *item) { if (CommEnabled || numplayers > 1) { @@ -2811,8 +2793,7 @@ MNU_TenCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_LoadGameCheck(MenuItem *item) +SWBOOL MNU_LoadGameCheck(MenuItem *item) { if (0) // JBF: Until we fix the symbol table dilemma, loading is off limits @@ -2830,8 +2811,7 @@ MNU_LoadGameCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_StatCheck(MenuItem *item) +SWBOOL MNU_StatCheck(MenuItem *item) { if (CommEnabled || numplayers > 1) { @@ -2842,8 +2822,7 @@ MNU_StatCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_HurtTeammateCheck(MenuItem *item) +SWBOOL MNU_HurtTeammateCheck(MenuItem *item) { switch (gs.NetGameType+1) { @@ -2864,8 +2843,7 @@ MNU_HurtTeammateCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_TeamPlayCheck(MenuItem *item) +SWBOOL MNU_TeamPlayCheck(MenuItem *item) { switch (gs.NetGameType+1) { @@ -2881,8 +2859,7 @@ MNU_TeamPlayCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_CoopPlayCheck(MenuItem *item) +SWBOOL MNU_CoopPlayCheck(MenuItem *item) { switch (gs.NetGameType+1) { @@ -2906,8 +2883,7 @@ MNU_TeamPlayChange(void) return TRUE; } -SWBOOL -MNU_MouseCheck(MenuItem *item) +SWBOOL MNU_MouseCheck(MenuItem *item) { if (!CONTROL_MousePresent) { @@ -2956,15 +2932,13 @@ MNU_MusicCheck(MenuItem *item) return TRUE; } -SWBOOL -MNU_FxCheck(MenuItem *item) +SWBOOL MNU_FxCheck(MenuItem *item) { RESET(item->flags, mf_disabled); return TRUE; } -SWBOOL -MNU_MusicFxCheck(MenuItem *item) +SWBOOL MNU_MusicFxCheck(MenuItem *item) { RESET(item->flags, mf_disabled); return TRUE; @@ -2973,8 +2947,7 @@ MNU_MusicFxCheck(MenuItem *item) //////////////////////////////////////////////// // Do a toggle button //////////////////////////////////////////////// -void -MNU_DoButton(MenuItem_p item, SWBOOL draw) +void MNU_DoButton(MenuItem_p item, SWBOOL draw) { int x, y; SWBOOL state; @@ -3708,8 +3681,7 @@ MNU_SetupMenu(void) //////////////////////////////////////////////// // Draw an item //////////////////////////////////////////////// -static void -MNU_ClearFlags(MenuGroup *node) +static void MNU_ClearFlags(MenuGroup * node) { MenuItem *i; @@ -3727,8 +3699,7 @@ MNU_ClearFlags(MenuGroup *node) //////////////////////////////////////////////// // Pop a group off the menu stack //////////////////////////////////////////////// -static void -MNU_PopGroup(void) +static void MNU_PopGroup(void) { if (!menuarrayptr) return; @@ -3742,8 +3713,7 @@ MNU_PopGroup(void) //////////////////////////////////////////////// // Push a group on to the menu stack //////////////////////////////////////////////// -static void -MNU_PushGroup(MenuGroup *node) +static void MNU_PushGroup(MenuGroup * node) { if (menuarrayptr == MaxLayers - 1) return; @@ -3756,15 +3726,13 @@ MNU_PushGroup(MenuGroup *node) //////////////////////////////////////////////// // Setup a new menu subgroup //////////////////////////////////////////////// -static void -MNU_SetupGroup(void) +static void MNU_SetupGroup(void) { MNU_SelectItem(currentmenu, currentmenu->cursor, FALSE); MNU_DrawMenu(); } -static void -MNU_ItemPreProcess(MenuGroup *group) +static VOID MNU_ItemPreProcess(MenuGroup * group) { MenuItem *item; @@ -3780,8 +3748,7 @@ MNU_ItemPreProcess(MenuGroup *group) } } -void -MNU_ItemPostProcess(MenuGroup *group) +void MNU_ItemPostProcess(MenuGroup *group) { MenuItem *item; int zero = 0; @@ -3800,8 +3767,7 @@ MNU_ItemPostProcess(MenuGroup *group) //////////////////////////////////////////////// // Go to next menu subgroup //////////////////////////////////////////////// -static void -MNU_DownLevel(MenuGroup *group) +static void MNU_DownLevel(MenuGroup * group) { if (!group) @@ -3829,15 +3795,14 @@ MNU_DownLevel(MenuGroup *group) //////////////////////////////////////////////// // Go to previous menu subgroup //////////////////////////////////////////////// -static void -MNU_UpLevel(void) +static void MNU_UpLevel(void) { int zero = 0; static int handle1=0; // if run out of menus then EXIT if (!menuarrayptr) { - if (!FX_SoundActive(handle1)) + if(!FX_SoundActive(handle1)) handle1 = PlaySound(DIGI_STARCLINK,&zero,&zero,&zero,v3df_dontpan); ExitMenus(); return; @@ -3854,8 +3819,8 @@ MNU_UpLevel(void) //////////////////////////////////////////////// // Do a menu item action //////////////////////////////////////////////// -static void -MNU_DoItem(void) + +static void MNU_DoItem(void) { MenuItem *item; @@ -3896,8 +3861,7 @@ MNU_DoItem(void) //////////////////////////////////////////////// // Draw an item icon or cursor //////////////////////////////////////////////// -static void -MNU_DrawItemIcon(MenuItem *item) +static void MNU_DrawItemIcon(MenuItem * item) { //void BorderRefreshClip(PLAYERp pp, short x, short y, short x2, short y2); int x = item->x, y = item->y; @@ -3927,8 +3891,7 @@ MNU_DrawItemIcon(MenuItem *item) //////////////////////////////////////////////// // Draw an item //////////////////////////////////////////////// -static void -MNU_DrawItem(MenuItem *item) +static void MNU_DrawItem(MenuItem * item) { char *ptr; short px, py; @@ -3970,8 +3933,7 @@ MNU_DrawItem(MenuItem *item) //////////////////////////////////////////////// // Draw the menu contents //////////////////////////////////////////////// -static void -MNU_DrawMenuContents(void) +static void MNU_DrawMenuContents(void) { MenuItem *item; short w,h; @@ -4035,8 +3997,7 @@ MNU_DrawMenuContents(void) //////////////////////////////////////////////// // Draw the menu //////////////////////////////////////////////// -void -MNU_DrawMenu(void) +void MNU_DrawMenu(void) { if (cust_callback != NULL) { @@ -4053,8 +4014,7 @@ MNU_DrawMenu(void) //////////////////////////////////////////////// // Select a menu item //////////////////////////////////////////////// -void -MNU_SelectItem(MenuGroup *group, short index, SWBOOL draw) +void MNU_SelectItem(MenuGroup * group, short index, SWBOOL draw) { MenuItem *item; @@ -4068,6 +4028,7 @@ MNU_SelectItem(MenuGroup *group, short index, SWBOOL draw) group->cursor = index; item = &group->items[group->cursor]; + item->flags |= mf_selected; if (draw) MNU_DrawItem(item); @@ -4076,8 +4037,7 @@ MNU_SelectItem(MenuGroup *group, short index, SWBOOL draw) //////////////////////////////////////////////// // Toggle a menu radio button on/off //////////////////////////////////////////////// -static void -MNU_PushItem(MenuItem *item, SWBOOL draw) +static void MNU_PushItem(MenuItem * item, SWBOOL draw) { if (item->type != mt_button) return; @@ -4085,14 +4045,13 @@ MNU_PushItem(MenuItem *item, SWBOOL draw) buttonsettings[item->button] ^= 1; // if (draw) - MNU_DoButton(item, draw); + MNU_DoButton(item, draw); } //////////////////////////////////////////////// // Go to next item on menu //////////////////////////////////////////////// -static void -MNU_NextItem(void) +static void MNU_NextItem(void) { MenuTag type; MenuFlags flag; @@ -4115,8 +4074,7 @@ MNU_NextItem(void) //////////////////////////////////////////////// // Go to previous item on menu //////////////////////////////////////////////// -static void -MNU_PrevItem(void) +static void MNU_PrevItem(void) { MenuTag type; MenuFlags flag; @@ -4135,8 +4093,7 @@ MNU_PrevItem(void) //////////////////////////////////////////////// // Find hotkey press on current menu, if any. //////////////////////////////////////////////// -static SWBOOL -MNU_DoHotkey(void) +static SWBOOL MNU_DoHotkey(void) { MenuItem_p item; short index; @@ -4160,8 +4117,7 @@ MNU_DoHotkey(void) //////////////////////////////////////////////// // Setup Menus //////////////////////////////////////////////// -void -SetupMenu(void) +void SetupMenu(void) { if (!UsingMenus && !ConPanel) // Doing this check for multiplay // menus @@ -4182,7 +4138,7 @@ SetupMenu(void) //////////////////////////////////////////////// #define MNU_SENSITIVITY 10 // The menu's mouse sensitivity, should be real low -void MNU_DoMenu(CTLType type, PLAYERp pp) +void MNU_DoMenu( CTLType type, PLAYERp pp ) { SWBOOL resetitem; unsigned char key; @@ -4280,8 +4236,7 @@ void MNU_DoMenu(CTLType type, PLAYERp pp) //////////////////////////////////////////////// // Checks to see if we should be in menus //////////////////////////////////////////////// -void -MNU_CheckForMenus(void) +void MNU_CheckForMenus(void) { extern SWBOOL GamePaused; @@ -4305,8 +4260,7 @@ MNU_CheckForMenus(void) } } -void -MNU_CheckForMenusAnyKey(void) +void MNU_CheckForMenusAnyKey(void) { if (UsingMenus) { @@ -4386,8 +4340,7 @@ unsigned char palette_data[256][3]; // Global palette array // WaitForVsync // Waits for a vertical retrace to occur. If one is in progress, it waits for the next one. ///////////////////////////////////////////////// -void -WaitForVsync(void) +void WaitForVsync(void) { while (inp(VGA_INPUT_STATUS_1) & VGA_VSYNC_MASK) ; // Retrace in progress, wait. @@ -4396,8 +4349,7 @@ WaitForVsync(void) while (!inp(VGA_INPUT_STATUS_1) & VGA_VSYNC_MASK) ; } -void -Get_Palette(unsigned char *pal) +void Get_Palette(unsigned char *pal) { int i; @@ -4405,8 +4357,8 @@ Get_Palette(unsigned char *pal) for (i = 0; i < 768; i++) pal[i] = inp(PALETTE_DATA); } -void -Set_Palette(unsigned char *buff) + +void Set_Palette(unsigned char *buff) { int i; @@ -4429,8 +4381,7 @@ Set_Palette(unsigned char *buff) // Heres some temp timer junk for this routine. Replace it with game timer stuff later. //unsigned int *clock = (unsigned int *)0x046C; -void -Fade_Timer(int clicks) +void Fade_Timer(int clicks) { // unsigned int now; int now; @@ -4440,8 +4391,7 @@ Fade_Timer(int clicks) while (abs((int32_t) totalclock - now) < clicks) handleevents(); } -void -FadeIn(unsigned char startcolor, unsigned int clicks) +void FadeIn(unsigned char startcolor, unsigned int clicks) { int i, palreg, usereg, tmpreg1 = 0, tmpreg2 = 0; RGB_color color; @@ -4498,8 +4448,7 @@ FadeIn(unsigned char startcolor, unsigned int clicks) } } -void -FadeOut(unsigned char targetcolor, unsigned int clicks) +void FadeOut(unsigned char targetcolor, unsigned int clicks) { int i, palreg, usereg = 0, tmpreg1 = 0, tmpreg2 = 0; RGB_color color; @@ -4601,8 +4550,7 @@ unsigned char ppalette[MAX_SW_PLAYERS_REG][768]; // Set the amount of redness for damage // the player just took ////////////////////////////////////////// -void -SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor) +void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor) { int palreg, usereg = 0, tmpreg1 = 0, tmpreg2 = 0; short fadedamage=0; @@ -4721,8 +4669,7 @@ SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor) // Do the screen reddness based on damage ////////////////////////////////////////// #define MAXFADETICS 5 -void -DoPaletteFlash(PLAYERp pp) +void DoPaletteFlash(PLAYERp pp) { int i, palreg, tmpreg1 = 0, tmpreg2 = 0; unsigned char *pal_ptr = &ppalette[screenpeek][0]; diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index d6b88d9fa..358935699 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -277,7 +277,7 @@ typedef struct MenuGroup short cursor; // This is the current menu item the // cursor is resting on. -} MenuGroup, *MenuGroup_p; +} *MenuGroup_p; // Custom Routine Prototypes //////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/names2.h b/source/sw/src/names2.h index 25af93c45..2c435e586 100644 --- a/source/sw/src/names2.h +++ b/source/sw/src/names2.h @@ -456,6 +456,7 @@ enum STAT_ENUMS #define COOLG_PAIN_R4 COOLG_PAIN_R0 //+ (COOLIE_PAIN_FRAMES * 4) #define COOLIE_DEAD_NOHEAD 1440 +#define COOLIE_DEAD_HEAD 4267 #define COOLIE_DIE 4260 #define COOLIE_DEAD 4268 @@ -657,6 +658,7 @@ enum STAT_ENUMS #define NINJA_SLICED 4227 #define NINJA_DEAD_SLICED NINJA_SLICED+9 +#define NINJA_SLICED_HACK 4211 #define NINJA_Head_FRAMES 1 #define NINJA_Head_R0 1142 diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 5b238a3ea..1eb21c93f 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -140,15 +140,9 @@ void netsendpacket(int ind, uint8_t* buf, int len) { if ((unsigned)len > sizeof(packbuf)) { - buildprintf("netsendpacket(): packet length > %d!\n",(int)sizeof(packbuf)); len = sizeof(packbuf); } - buildprintf("netsendpacket() sends proxy to %d\nPlayerIndex=%d Contents:",connecthead,ind); - for (i=0; iPacketType = PACKET_TYPE_PROXY; prx->PlayerIndex = (uint8_t)ind; memcpy(&prx[1], buf, len); // &prx[1] == (char*)prx + sizeof(PACKET_PROXY) @@ -160,10 +154,6 @@ void netsendpacket(int ind, uint8_t* buf, int len) //sendpacket(ind, buf, len); - buildprintf("netsendpacket() sends normal to %d\nContents:",ind); - for (i=0; i sizeof(packbuf)) { - buildprintf("netbroadcastpacket(): packet length > %d!\n",(int)sizeof(packbuf)); len = sizeof(packbuf); } - buildprintf("netbroadcastpacket() sends proxy to %d\nPlayerIndex=255 Contents:",connecthead); - for (i=0; iPacketType = PACKET_TYPE_PROXY; prx->PlayerIndex = (uint8_t)(-1); @@ -218,20 +203,12 @@ int netgetpacket(int *ind, uint8_t* buf) { if (len > 0) { - buildprintf("netgetpacket() gets normal from %d\nContents:",*ind); - for (i=0; iPlayerIndex); - for (i=0; iFlags2, SPR2_DYING)) { - NewStateGroup(SpriteNum, sg_NinjaGrabThroat); + if (sw_ninjahack) + NewStateGroup(SpriteNum, sg_NinjaHariKari); + else + NewStateGroup(SpriteNum, sg_NinjaGrabThroat); return 0; } @@ -2095,7 +2126,10 @@ int DoNinjaPain(short SpriteNum) if (TEST(u->Flags2, SPR2_DYING)) { - NewStateGroup(SpriteNum, sg_NinjaGrabThroat); + if (sw_ninjahack) + NewStateGroup(SpriteNum, sg_NinjaHariKari); + else + NewStateGroup(SpriteNum, sg_NinjaGrabThroat); return 0; } diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index eaa901864..e1f98170a 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -118,8 +118,7 @@ int ChangeWeapon(PLAYERp); ANIMATOR InitFire; -int -NullAnimator(short SpriteNum) +int NullAnimator(short SpriteNum) { return 0; } @@ -129,8 +128,7 @@ void pNullAnimator(PANEL_SPRITEp psp) return; } -PANEL_SPRITEp -pFindMatchingSprite(PLAYERp pp, int x, int y, short pri) +PANEL_SPRITEp pFindMatchingSprite(PLAYERp pp, int x, int y, short pri) { PANEL_SPRITEp nsp; PANEL_SPRITEp psp=NULL, next; @@ -150,8 +148,7 @@ pFindMatchingSprite(PLAYERp pp, int x, int y, short pri) return NULL; } -PANEL_SPRITEp -pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pri) +PANEL_SPRITEp pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pri) { PANEL_SPRITEp nsp; PANEL_SPRITEp psp=NULL, next; @@ -171,8 +168,7 @@ pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pri) return NULL; } -SWBOOL -pKillScreenSpiteIDs(PLAYERp pp, short id) +SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id) { PANEL_SPRITEp nsp=NULL; PANEL_SPRITEp psp=NULL, next; @@ -194,8 +190,7 @@ pKillScreenSpiteIDs(PLAYERp pp, short id) // Used to sprites in the view at correct aspect ratio and x,y location. -PANEL_SPRITEp -pSpawnFullViewSprite(PLAYERp pp, short pic, short pri, int x, int y) +PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp, short pic, short pri, int x, int y) { PANEL_SPRITEp nsp; @@ -219,8 +214,7 @@ pSpawnFullViewSprite(PLAYERp pp, short pic, short pri, int x, int y) // Used to display panel info at correct aspect ratio and x,y location on the // status panel. Sprites will kill themselves after writing to all pages. -PANEL_SPRITEp -pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y) +PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y) { PANEL_SPRITEp nsp; @@ -294,8 +288,7 @@ void ArmorCalc(int damage_amt, int *armor_damage, int *player_damage) } -void -PlayerUpdateHealth(PLAYERp pp, short value) +void PlayerUpdateHealth(PLAYERp pp, short value) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -421,8 +414,7 @@ PlayerUpdateHealth(PLAYERp pp, short value) } -void -PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) +void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -488,8 +480,7 @@ PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value) DisplayPanelNumber(pp, x, y, pp->WpnAmmo[WeaponNum]); } -void -PlayerUpdateWeaponSummary(PLAYERp pp, short UpdateWeaponNum) +void PlayerUpdateWeaponSummary(PLAYERp pp, short UpdateWeaponNum) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -568,8 +559,7 @@ void PlayerUpdateWeaponSummaryAll(PLAYERp pp) } } -void -PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) +void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) { USERp u = User[pp->PlayerSprite]; @@ -586,8 +576,7 @@ PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) PlayerUpdateWeaponSummaryAll(pp); } -void -PlayerUpdateKills(PLAYERp pp, short value) +void PlayerUpdateKills(PLAYERp pp, short value) { USERp u = User[pp->PlayerSprite]; @@ -635,8 +624,7 @@ PlayerUpdateKills(PLAYERp pp, short value) DisplayFragNumbers(pp); } -void -PlayerUpdateArmor(PLAYERp pp, short value) +void PlayerUpdateArmor(PLAYERp pp, short value) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -671,8 +659,7 @@ PlayerUpdateArmor(PLAYERp pp, short value) } -void -PlayerUpdateKeys(PLAYERp pp) +void PlayerUpdateKeys(PLAYERp pp) { #define PANEL_KEYS_BOX_X 276 #define PANEL_KEYS_XOFF 0 @@ -754,8 +741,7 @@ PlayerUpdateKeys(PLAYERp pp) } } -void -PlayerUpdateTimeLimit(PLAYERp pp) +void PlayerUpdateTimeLimit(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; short x,y; @@ -781,8 +767,7 @@ PlayerUpdateTimeLimit(PLAYERp pp) DisplaySummaryString(pp, PANEL_KEYS_BOX_X+1, PANEL_BOX_Y+6, 0, 0, ds); } -void -PlayerUpdatePanelInfo(PLAYERp pp) +void PlayerUpdatePanelInfo(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; int i; @@ -790,6 +775,9 @@ PlayerUpdatePanelInfo(PLAYERp pp) if (Prediction) return; + if (UsingMenus) + return; + PlayerUpdateHealth(pp, 0); PlayerUpdateInventory(pp, pp->InventoryNum); PlayerUpdateAmmo(pp, u->WeaponNum, 0); @@ -800,8 +788,7 @@ PlayerUpdatePanelInfo(PLAYERp pp) PlayerUpdateTimeLimit(pp); } -int -WeaponOperate(PLAYERp pp) +int WeaponOperate(PLAYERp pp) { short weapon; int DoPlayerSpriteReset(short SpriteNum); @@ -896,6 +883,7 @@ WeaponOperate(PLAYERp pp) if (TEST(pp->Flags, PF_TWO_UZI)) { pp->WpnUziType++; + PlaySound(DIGI_UZI_UP, &pp->posx, &pp->posy, &pp->posz, v3df_follow); if (pp->WpnUziType > 1) pp->WpnUziType = 0; } @@ -908,6 +896,7 @@ WeaponOperate(PLAYERp pp) if (u->WeaponNum == WPN_MICRO) { pp->WpnRocketType++; + PlaySound(DIGI_ROCKET_UP, &pp->posx, &pp->posy, &pp->posz, v3df_follow); if (pp->WpnRocketType > 2) pp->WpnRocketType = 0; if (pp->WpnRocketType == 2 && pp->WpnRocketNuke == 0) @@ -1017,11 +1006,19 @@ WeaponOperate(PLAYERp pp) SWBOOL WeaponOK(PLAYERp pp) { - USERp u = User[pp->PlayerSprite]; + USERp u; short min_ammo, WeaponNum, FindWeaponNum; static char wpn_order[] = {2,3,4,5,6,7,8,9,1,0}; unsigned wpn_ndx=0; + if ((unsigned)pp->PlayerSprite >= MAXSPRITES) + return(FALSE); + + u = User[pp->PlayerSprite]; + + if (u == NULL) + return(FALSE); + // sword if (DamageData[u->WeaponNum].max_ammo == -1) return TRUE; @@ -1262,8 +1259,7 @@ void SpecialUziRetractFunc(PANEL_SPRITEp psp) } } -void -RetractCurWpn(PLAYERp pp) +void RetractCurWpn(PLAYERp pp) { // Retract old weapon if (pp->CurWpn) @@ -6277,9 +6273,11 @@ pChopsWait(PANEL_SPRITEp psp) } } -void -ChopsSetRetract(PLAYERp pp) -{ +void ChopsSetRetract(PLAYERp pp) + { + if (pp == NULL || pp->Chops == NULL) + return; + pSetState(pp->Chops, pp->Chops->RetractState); } @@ -7450,6 +7448,7 @@ pDisplaySprites(PLAYERp pp) break; case STAR_REST: + case 2510: if (!useDarts) picnum = 2138; else diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index ab2a1e9a9..904392548 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -6368,8 +6368,8 @@ char *KilledPlayerMessage(PLAYERp pp, PLAYERp killer) { #define MAX_KILL_NOTES 16 short rnd = STD_RANDOM_RANGE(MAX_KILL_NOTES); - char *p1 = pp->PlayerName; - char *p2 = killer->PlayerName; + const char *p1 = pp->PlayerName; + const char *p2 = killer->PlayerName; if (pp->HitBy == killer->PlayerSprite) { @@ -7511,14 +7511,20 @@ DoPlayerRun(PLAYERp pp) } -int +void PlayerStateControl(int16_t SpriteNum) { USERp u; + if ((unsigned)SpriteNum >= MAXSPRITES) + return; + // Convienience var u = User[SpriteNum]; + if (u == NULL) + return; + u->Tics += synctics; // Skip states if too much time has passed @@ -7562,7 +7568,7 @@ PlayerStateControl(int16_t SpriteNum) if (u->State->Animator) (*u->State->Animator)(SpriteNum); - return 0; + return; } void @@ -7599,9 +7605,15 @@ MoveSkipSavePos(void) { TRAVERSE_SPRITE_STAT(headspritestat[stat], i, nexti) { + if ((unsigned)i >= MAXSPRITES) + continue; + sp = &sprite[i]; u = User[i]; + if (sp == NULL || u == NULL) + continue; + u->ox = sp->x; u->oy = sp->y; u->oz = sp->z; @@ -7618,9 +7630,13 @@ MoveSkipSavePos(void) { TRAVERSE_SPRITE_STAT(headspritestat[stat], i, nexti) { + if ((unsigned)i >= MAXSPRITES) + continue; sp = &sprite[i]; u = User[i]; + if (sp == NULL || u == NULL) + continue; u->ox = sp->x; u->oy = sp->y; u->oz = sp->z; diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 3ee8e5b48..ceaf7d78b 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -110,8 +110,7 @@ extern STATE s_NotRestored[]; OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist}; -int -PanelSpriteToNdx(PLAYERp pp, PANEL_SPRITEp psprite) +int PanelSpriteToNdx(PLAYERp pp, PANEL_SPRITEp psprite) { short ndx = 0; PANEL_SPRITEp psp=NULL, next=NULL; @@ -132,8 +131,7 @@ PanelSpriteToNdx(PLAYERp pp, PANEL_SPRITEp psprite) } -PANEL_SPRITEp -PanelNdxToSprite(PLAYERp pp, int ndx) +PANEL_SPRITEp PanelNdxToSprite(PLAYERp pp, int ndx) { short count = 0; PANEL_SPRITEp psp, next; @@ -176,6 +174,7 @@ int SaveSymDataInfo(MFILE_WRITE fil, void *ptr) return 0; } + static int SaveSymCodeInfo_raw(MFILE_WRITE fil, void *ptr) { savedcodesym sym; diff --git a/source/sw/src/scrip2.cpp b/source/sw/src/scrip2.cpp index 16b1bd7a9..aa770c3c2 100644 --- a/source/sw/src/scrip2.cpp +++ b/source/sw/src/scrip2.cpp @@ -154,7 +154,7 @@ void GetToken(SWBOOL crossline) if (script_p >= scriptend_p) { if (!crossline) - buildprintf("Error: Line %i is incomplete\n",scriptline); + initprintf("Error: Line %i is incomplete\n",scriptline); endofscript = TRUE; return; } @@ -168,14 +168,14 @@ skipspace: if (script_p >= scriptend_p) { if (!crossline) - buildprintf("Error: Line %i is incomplete\n",scriptline); + initprintf("Error: Line %i is incomplete\n",scriptline); endofscript = TRUE; return; } if (*script_p++ == '\n') { if (!crossline) - buildprintf("Error: Line %i is incomplete\n",scriptline); + initprintf("Error: Line %i is incomplete\n",scriptline); scriptline++; } } @@ -183,7 +183,7 @@ skipspace: if (script_p >= scriptend_p) { if (!crossline) - buildprintf("Error: Line %i is incomplete\n",scriptline); + initprintf("Error: Line %i is incomplete\n",scriptline); endofscript = TRUE; return; } @@ -191,7 +191,7 @@ skipspace: if (*script_p == '#') // # is comment field { if (!crossline) - buildprintf("Error: Line %i is incomplete\n",scriptline); + initprintf("Error: Line %i is incomplete\n",scriptline); while (*script_p++ != '\n') if (script_p >= scriptend_p) { @@ -212,7 +212,7 @@ skipspace: if (script_p == scriptend_p) break; ASSERT(token_p != &token[MAXTOKEN]); -// buildprintf("Error: Token too large on line %i\n",scriptline); +// initprintf("Error: Token too large on line %i\n",scriptline); } *token_p = 0; @@ -495,7 +495,6 @@ static int cm_transtok(const char *tok, const struct _tokset *set, const unsigne return -1; } -// Load custom map and episode information // level # { // title "Map Name" // filename "filename.map" @@ -613,7 +612,7 @@ void LoadCustomInfoFromScript(const char *filename) // first map file in LevelInfo[] is bogus, last map file is NULL if (curmap < 1 || curmap > MAX_LEVELS_REG) { - buildprintf("Error: map number %d not in range 1-%d on line %s:%d\n", + initprintf("Error: map number %d not in range 1-%d on line %s:%d\n", curmap, MAX_LEVELS_REG, script->filename, scriptfile_getlinum(script,mapnumptr)); script->textptr = braceend; @@ -687,7 +686,7 @@ void LoadCustomInfoFromScript(const char *filename) break; } default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; @@ -706,7 +705,7 @@ void LoadCustomInfoFromScript(const char *filename) // first map file in LevelInfo[] is bogus, last map file is NULL if ((unsigned)--curmap >= 2u) { - buildprintf("Error: episode number %d not in range 1-2 on line %s:%d\n", + initprintf("Error: episode number %d not in range 1-2 on line %s:%d\n", curmap, script->filename, scriptfile_getlinum(script,epnumptr)); script->textptr = braceend; @@ -738,7 +737,7 @@ void LoadCustomInfoFromScript(const char *filename) break; } default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; @@ -757,7 +756,7 @@ void LoadCustomInfoFromScript(const char *filename) // first map file in LevelInfo[] is bogus, last map file is NULL if ((unsigned)--curmap >= 4u) { - buildprintf("Error: skill number %d not in range 1-4 on line %s:%d\n", + initprintf("Error: skill number %d not in range 1-4 on line %s:%d\n", curmap, script->filename, scriptfile_getlinum(script,epnumptr)); script->textptr = braceend; @@ -780,7 +779,7 @@ void LoadCustomInfoFromScript(const char *filename) break; } default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; @@ -859,7 +858,7 @@ void LoadCustomInfoFromScript(const char *filename) if ((unsigned)--in >= (unsigned)InvDecl_TOTAL) { - buildprintf("Error: inventory item number not in range 1-%d on line %s:%d\n", + initprintf("Error: inventory item number not in range 1-%d on line %s:%d\n", InvDecl_TOTAL, script->filename, scriptfile_getlinum(script,invnumptr)); script->textptr = braceend; @@ -879,7 +878,7 @@ void LoadCustomInfoFromScript(const char *filename) if (scriptfile_getnumber(script, &amt)) break; break; default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; @@ -911,7 +910,7 @@ void LoadCustomInfoFromScript(const char *filename) if ((unsigned)--in >= (unsigned)SIZ(weaponmap)) { - buildprintf("Error: weapon number not in range 1-%d on line %s:%d\n", + initprintf("Error: weapon number not in range 1-%d on line %s:%d\n", (int)SIZ(weaponmap), script->filename, scriptfile_getlinum(script,wpnnumptr)); script->textptr = braceend; @@ -946,7 +945,7 @@ void LoadCustomInfoFromScript(const char *filename) if (scriptfile_getnumber(script, &wpickup)) break; break; default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; @@ -984,7 +983,7 @@ void LoadCustomInfoFromScript(const char *filename) case CM_SECRET: case CM_QUIT: default: - buildprintf("Error on line %s:%d\n", + initprintf("Error on line %s:%d\n", script->filename, scriptfile_getlinum(script,script->ltextptr)); break; diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 2b62da57e..527984919 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -792,7 +792,7 @@ DoSpringBoardDown(void) { int destz; - destz = sector[nextsectorneighborz(sbp->Sector, sector[sbp->Sector].floorz, 1, 1)].floorz; + destz = sector[nextsectorneighborz(sbp->Sector, sector[sbp->Sector].floorz, SEARCH_FLOOR, SEARCH_DOWN)].floorz; AnimSet(§or[sbp->Sector].floorz, destz, 256); diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index a732f8187..1142c2016 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -583,8 +583,7 @@ StopSound(void) #define MAXLEVLDIST 19000 // The higher the number, the further away you can hear sound -short -SoundDist(int x, int y, int z, int basedist) +short SoundDist(int x, int y, int z, int basedist) { double tx, ty, tz; double sqrdist,retval; @@ -637,8 +636,7 @@ SoundDist(int x, int y, int z, int basedist) // Angle calcuations - may need to be checked to make sure they are right // -short -SoundAngle(int x, int y) +short SoundAngle(int x, int y) { extern short screenpeek; @@ -783,8 +781,7 @@ SWBOOL CacheSound(int num, int type) #define SOUND_UNIT MAXLEVLDIST/255 // NOTE: If v3df_follow == 1, x,y,z are considered literal coordinates -int -PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags) +int PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags) { VOC_INFOp vp; VOC3D_INFOp v3p; @@ -1221,8 +1218,7 @@ void COVER_SetReverb(int amt) =================== */ -void -MusicShutdown(void) +void MusicShutdown(void) { StopSong(); @@ -1980,5 +1976,4 @@ PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags) PlaySound(u->Attrib->Sounds[attrib_ndx], &sp->x, &sp->y, &sp->z, flags); } -// vim:ts=4:sw=4:expandtab: END_SW_NS diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index ea468bc49..9c68a9a27 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -777,7 +777,7 @@ KillSprite(int16_t SpriteNum) { TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) { - if (User[i]->tgt_sp == sp) + if ((unsigned)i < MAXSPRITES && User[i] != NULL && User[i]->tgt_sp == sp) { DoActorPickClosePlayer(i); } @@ -957,6 +957,9 @@ SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int int16_t SpriteNum; USERp u; + if (sectnum < 0) + return -1; + ASSERT(!Prediction); PRODUCTION_ASSERT(sectnum >= 0 && sectnum < MAXSECTORS); @@ -1083,7 +1086,7 @@ ActorTestSpawn(SPRITEp sp) case ZILLA_RUN_R0: c = "zilla"; break; default: c = "?"; break; } - buildprintf("WARNING: skill-masked %s at %d,%d,%d not being killed because it " + initprintf("WARNING: skill-masked %s at %d,%d,%d not being killed because it " "activates something\n", c, TrackerCast(sp->x), TrackerCast(sp->y), TrackerCast(sp->z)); return TRUE; } @@ -5953,11 +5956,8 @@ KeyMain: if (pp->WpnAmmo[WPN_STAR] >= DamageData[WPN_STAR].max_ammo) break; -#ifdef UK_VERSION - sprintf(ds,"Darts"); -#else - //sprintf(ds,"Shurikens"); -#endif + //if (useDarts) sprintf(ds,"Darts"); + //else sprintf(ds,"Shurikens"); PutStringInfo(Player+pnum, DamageData[WPN_STAR].weapon_name); PlayerUpdateAmmo(pp, WPN_STAR, DamageData[WPN_STAR].weapon_pickup); SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup @@ -6937,6 +6937,8 @@ SpriteControl(void) { u = User[i]; + if (u == 0) + continue; if (u->Tics) { if ((u->Tics -= synctics) <= 0) @@ -6966,6 +6968,9 @@ SpriteControl(void) if (!TEST(u->Flags, SPR_ACTIVE)) continue; + if (i == 69 && nexti == -1) + continue; + (*User[i]->ActorActionFunc)(i); } diff --git a/source/sw/src/sumo.cpp b/source/sw/src/sumo.cpp index 5044fadf0..c5a547105 100644 --- a/source/sw/src/sumo.cpp +++ b/source/sw/src/sumo.cpp @@ -884,7 +884,7 @@ BossHealthMeter(void) serpwasseen = TRUE; if (!SW_SHAREWARE && MusicEnabled()) { - PlaySong(0, 13, TRUE, TRUE); + PlaySong(0, ThemeTrack[2], TRUE, TRUE); } } else if (i == 1 && !sumowasseen) @@ -892,7 +892,7 @@ BossHealthMeter(void) sumowasseen = TRUE; if (!SW_SHAREWARE && MusicEnabled()) { - PlaySong(0, 13, TRUE, TRUE); + PlaySong(0, ThemeTrack[3], TRUE, TRUE); } } else if (i == 2 && !zillawasseen) @@ -900,7 +900,7 @@ BossHealthMeter(void) zillawasseen = TRUE; if (!SW_SHAREWARE && MusicEnabled()) { - PlaySong(0, 13, TRUE, TRUE); + PlaySong(0, ThemeTrack[4], TRUE, TRUE); } } } @@ -922,7 +922,7 @@ BossHealthMeter(void) // This is needed because of possible saved game situation if (!SW_SHAREWARE && !triedplay) { - PlaySong(0, 13, TRUE, FALSE); + PlaySong(0, ThemeTrack[i+2], TRUE, FALSE); triedplay = TRUE; // Only try once, then give up } diff --git a/source/sw/src/swcvar.cpp b/source/sw/src/swcvar.cpp new file mode 100644 index 000000000..d8a4ab056 --- /dev/null +++ b/source/sw/src/swcvar.cpp @@ -0,0 +1,3 @@ +#include "swcvars.h" + +CVAR(Bool, sw_ninjahack, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); diff --git a/source/sw/src/swcvar.h b/source/sw/src/swcvar.h new file mode 100644 index 000000000..8302d574e --- /dev/null +++ b/source/sw/src/swcvar.h @@ -0,0 +1,4 @@ +#include "c_cvars.h" + + +EXTERN_CVAR(Bool, sw_ninjahack) diff --git a/source/sw/src/text.cpp b/source/sw/src/text.cpp index ae27db43d..a63b97b58 100644 --- a/source/sw/src/text.cpp +++ b/source/sw/src/text.cpp @@ -61,8 +61,7 @@ const char *KeyDoorMessage[MAX_KEYS] = "You need a RED key for this door." }; -void -DisplaySummaryString(PLAYERp pp, short xs, short ys, short color, short shade, const char *buffer) +void DisplaySummaryString(PLAYERp pp, short xs, short ys, short color, short shade, const char *buffer) { short size,x; const char *ptr; @@ -98,8 +97,7 @@ DisplaySummaryString(PLAYERp pp, short xs, short ys, short color, short shade, c } } -PANEL_SPRITEp -pClearTextLineID(PLAYERp pp, short id, long y, short pri) +PANEL_SPRITEp pClearTextLineID(PLAYERp pp, short id, int y, short pri) { PANEL_SPRITEp nsp=NULL; PANEL_SPRITEp psp=NULL, next; @@ -122,8 +120,7 @@ pClearTextLineID(PLAYERp pp, short id, long y, short pri) } // only call this from menu code - it does a pKillSprite -PANEL_SPRITEp -pMenuClearTextLineID(PLAYERp pp, short id, long y, short pri) +PANEL_SPRITEp pMenuClearTextLineID(PLAYERp pp, short id, int y, short pri) { PANEL_SPRITEp nsp=NULL; PANEL_SPRITEp psp=NULL, next; @@ -146,15 +143,13 @@ pMenuClearTextLineID(PLAYERp pp, short id, long y, short pri) } -void -pClearTextLine(PLAYERp pp, long y) +void pClearTextLine(PLAYERp pp, int y) { SetRedrawScreen(pp); pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX); } -void -StringTimer(PANEL_SPRITEp psp) +void StringTimer(PANEL_SPRITEp psp) { if ((psp->kill_tics -= synctics) <= 0) { @@ -165,8 +160,7 @@ StringTimer(PANEL_SPRITEp psp) } } -void -PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds) +void PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds) { int ndx, offset; char c; @@ -213,14 +207,12 @@ PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds) } } -void -KillString(PLAYERp pp, short y) +void KillString(PLAYERp pp, short y) { pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX); } -PANEL_SPRITEp -pClearSpriteXY(PLAYERp pp, short x, short y) +PANEL_SPRITEp pClearSpriteXY(PLAYERp pp, short x, short y) { PANEL_SPRITEp nsp=NULL; PANEL_SPRITEp psp=NULL, next; @@ -234,8 +226,7 @@ pClearSpriteXY(PLAYERp pp, short x, short y) return NULL; } -PANEL_SPRITEp -pClearSpriteID(PLAYERp pp, short id) +PANEL_SPRITEp pClearSpriteID(PLAYERp pp, short id) { PANEL_SPRITEp nsp=NULL; PANEL_SPRITEp psp=NULL, next; @@ -250,8 +241,7 @@ pClearSpriteID(PLAYERp pp, short id) } -void -DisplayPanelNumber(PLAYERp pp, short xs, short ys, int number) +void DisplayPanelNumber(PLAYERp pp, short xs, short ys, int number) { char buffer[32]; char *ptr; @@ -273,8 +263,7 @@ DisplayPanelNumber(PLAYERp pp, short xs, short ys, int number) } } -void -DisplayMiniBarNumber(PLAYERp pp, short xs, short ys, int number) +void DisplayMiniBarNumber(PLAYERp pp, short xs, short ys, int number) { char buffer[32]; char *ptr; @@ -301,8 +290,7 @@ DisplayMiniBarNumber(PLAYERp pp, short xs, short ys, int number) } } -void -DisplayMiniBarSmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer) +void DisplayMiniBarSmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer) { short size=4,x; const char *ptr; @@ -321,14 +309,12 @@ DisplayMiniBarSmString(PLAYERp pp, short xs, short ys, short pal, const char *bu pic = FRAG_FIRST_TILE + (*ptr - FRAG_FIRST_ASCII); - rotatesprite((long)x << 16, (long)ys << 16, (1 << 16), 0, - pic, 0, pal, + rotatesprite((int)x << 16, (int)ys << 16, (1 << 16), 0, pic, 0, pal, ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER, 0, 0, xdim - 1, ydim - 1); } } -void -DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer) +void DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer) { short size=4,x; const char *ptr; @@ -352,8 +338,7 @@ DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer) } } -void -DisplayFragString(PLAYERp pp, short xs, short ys, const char *buffer) +void DisplayFragString(PLAYERp pp, short xs, short ys, const char *buffer) { short size=4,x; const char *ptr; @@ -383,8 +368,7 @@ DisplayFragString(PLAYERp pp, short xs, short ys, const char *buffer) } } -void -DisplayFragNumbers(PLAYERp pp) +void DisplayFragNumbers(PLAYERp pp) { char buffer[32]; char *ptr; @@ -423,8 +407,7 @@ DisplayFragNumbers(PLAYERp pp) DisplayFragString(pp, xs, ys, buffer); } -void -DisplayFragNames(PLAYERp pp) +void DisplayFragNames(PLAYERp pp) { char *ptr; short x, xs, ys, size; @@ -508,8 +491,7 @@ void PutStringInfoLine2(PLAYERp pp, const char *string) PutStringTimer(pp, x, y, string, GlobInfoStringTime); } -void -pMenuClearTextLine(PLAYERp pp) +void pMenuClearTextLine(PLAYERp pp) { pMenuClearTextLineID(pp, ID_TEXT, TEXT_INFO_LINE(0), PRI_FRONT_MAX); pMenuClearTextLineID(pp, ID_TEXT, TEXT_INFO_LINE(1), PRI_FRONT_MAX); diff --git a/source/sw/src/text.h b/source/sw/src/text.h index 4af8d0986..815cb976f 100644 --- a/source/sw/src/text.h +++ b/source/sw/src/text.h @@ -42,6 +42,6 @@ void DisplayPanelNumber(PLAYERp pp,short xs,short ys,int number); void PutStringInfo(PLAYERp pp, const char *string); void PutStringInfoLine(PLAYERp pp, const char *string); void PutStringInfoLine2(PLAYERp pp, const char *string); -void pClearTextLine(PLAYERp pp,long y); +void pClearTextLine(PLAYERp pp,int y); void pMenuClearTextLine(PLAYERp pp); END_SW_NS diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index b3f5255ef..dab981945 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1936,8 +1936,7 @@ PlayerPart: } } -void -RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, SWBOOL dynamic) +void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, SWBOOL dynamic) { short wallcount = 0, j, k, startwall, endwall, delta_ang_from_orig; SECTORp *sectp; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 90178d946..379a2ca53 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -38,6 +38,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "network.h" #include "pal.h" #include "vis.h" +#include "swcvar.h" #include "ai.h" #include "weapon.h" @@ -5402,6 +5403,7 @@ ActorHealth(short SpriteNum, short amt) case NINJA_RUN_R0: { extern STATEp sg_NinjaGrabThroat[]; + extern STATEp sg_NinjaHariKari[]; if (TEST(u->Flags2, SPR2_DYING)) return TRUE; if (TEST(u->Flags, SPR_FALLING | SPR_JUMPING | SPR_CLIMBING)) return TRUE; @@ -5421,6 +5423,9 @@ ActorHealth(short SpriteNum, short amt) InitBloodSpray(SpriteNum,FALSE,105); sp->ang = NORM_ANGLE(getangle(u->tgt_sp->x - sp->x, u->tgt_sp->y - sp->y) + 1024); RESET(sp->cstat, CSTAT_SPRITE_YFLIP); + if (sw_ninjahack) + NewStateGroup(SpriteNum, sg_NinjaHariKari); + else NewStateGroup(SpriteNum, sg_NinjaGrabThroat); } break; @@ -17893,7 +17898,7 @@ InitUzi(PLAYERp pp) static int uziclock=0; int clockdiff=0; SWBOOL FireSnd = FALSE; -#define UZIFIRE_WAIT 20 + #define UZIFIRE_WAIT 20 void InitUziShell(PLAYERp); @@ -20641,7 +20646,6 @@ SWBOOL TestDontStick(short SpriteNum, short hit_sect, short hit_wall, int hit_z) { ASSERT(SpriteNum>=0); hit_wall = NORM_WALL(u->ret); - hit_sect = sp->sectnum; } wp = &wall[hit_wall];