From 826f786dcc852dcc749bd7ba08522bcaed5ccdbb Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 27 Aug 2007 23:11:49 +0000 Subject: [PATCH] per-player max values for health, armor and ammo git-svn-id: https://svn.eduke32.com/eduke32@566 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 8 +-- polymer/eduke32/source/duke3d.h | 6 ++- polymer/eduke32/source/game.c | 46 ++++++++--------- polymer/eduke32/source/gamedef.c | 27 +++++----- polymer/eduke32/source/gamedef.h | 40 +++++++++++---- polymer/eduke32/source/gameexec.c | 84 ++++++++++++++++--------------- polymer/eduke32/source/global.c | 2 +- polymer/eduke32/source/osdcmds.c | 4 +- polymer/eduke32/source/player.c | 32 ++++++------ polymer/eduke32/source/premap.c | 6 +-- polymer/eduke32/source/savegame.c | 8 ++- polymer/eduke32/source/sector.c | 16 +++--- 12 files changed, 153 insertions(+), 126 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index d9eb652d3..ebeefec4b 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -100,8 +100,8 @@ void addammo(int weapon,player_struct *p,int amount) { p->ammo_amount[weapon] += amount; - if (p->ammo_amount[weapon] > max_ammo_amount[weapon]) - p->ammo_amount[weapon] = max_ammo_amount[weapon]; + if (p->ammo_amount[weapon] > p->max_ammo_amount[weapon]) + p->ammo_amount[weapon] = p->max_ammo_amount[weapon]; } void addweaponnoswitch(player_struct *p, int weapon) @@ -1067,7 +1067,7 @@ static void moveplayers(void) //Players } if (ud.god) { - s->extra = max_player_health; + s->extra = p->max_player_health; s->cstat = 257; p->jetpack_amount = 1599; } @@ -4524,7 +4524,7 @@ DETONATEB: } else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0) if (cansee(s->x,s->y,s->z-(8<<8),s->sectnum,g_player[p].ps->posx,g_player[p].ps->posy,g_player[p].ps->posz,g_player[p].ps->cursectnum)) - if (g_player[p].ps->ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) + if (g_player[p].ps->ammo_amount[HANDBOMB_WEAPON] < g_player[p].ps->max_ammo_amount[HANDBOMB_WEAPON]) { if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) { diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index b7aa6b95f..f01c188bc 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -66,7 +66,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType; #define BYTEVERSION_13 27 #define BYTEVERSION_14 116 #define BYTEVERSION_15 117 -#define BYTEVERSION_JF 174 // increase by 3, because atomic GRP adds 1, and Shareware adds 2 +#define BYTEVERSION_JF 177 // increase by 3, because atomic GRP adds 1, and Shareware adds 2 #define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) // JBF 20040116: different data files give different versions @@ -496,14 +496,16 @@ typedef struct { long max_secret_rooms,secret_rooms,max_actors_killed,actors_killed; long runspeed, movement_lock, team; + long max_player_health, max_shield_amount, max_ammo_amount[MAX_WEAPONS]; short sbs, sound_pitch; } player_struct; extern char tempbuf[2048], packbuf[576]; -extern long gc,max_player_health,max_armour_amount,max_ammo_amount[MAX_WEAPONS]; +extern long gc; extern long impact_damage,respawnactortime,respawnitemtime; +extern long start_armour_amount; #define MOVFIFOSIZ 256 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7a07523b7..36eae856c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1666,14 +1666,14 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(88,178,88+37,178+6); //original code: (96,178,96+12,178+6); weaponnum999(PISTOL_WEAPON,x,y, - p->ammo_amount[PISTOL_WEAPON],max_ammo_amount[PISTOL_WEAPON], + p->ammo_amount[PISTOL_WEAPON],p->max_ammo_amount[PISTOL_WEAPON], 12-20*(cw == PISTOL_WEAPON)); } if (u&8) { if (u != -1) patchstatusbar(88,184,88+37,184+6); //original code: (96,184,96+12,184+6); weaponnum999(SHOTGUN_WEAPON,x,y+6, - p->ammo_amount[SHOTGUN_WEAPON],max_ammo_amount[SHOTGUN_WEAPON], + p->ammo_amount[SHOTGUN_WEAPON],p->max_ammo_amount[SHOTGUN_WEAPON], (!p->gotweapon[SHOTGUN_WEAPON]*9)+12-18* (cw == SHOTGUN_WEAPON)); } @@ -1681,7 +1681,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(88,190,88+37,190+6); //original code: (96,190,96+12,190+6); weaponnum999(CHAINGUN_WEAPON,x,y+12, - p->ammo_amount[CHAINGUN_WEAPON],max_ammo_amount[CHAINGUN_WEAPON], + p->ammo_amount[CHAINGUN_WEAPON],p->max_ammo_amount[CHAINGUN_WEAPON], (!p->gotweapon[CHAINGUN_WEAPON]*9)+12-18* (cw == CHAINGUN_WEAPON)); } @@ -1689,7 +1689,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(127,178,127+29,178+6); //original code: (135,178,135+8,178+6); weaponnum(RPG_WEAPON,x+39,y, - p->ammo_amount[RPG_WEAPON],max_ammo_amount[RPG_WEAPON], + p->ammo_amount[RPG_WEAPON],p->max_ammo_amount[RPG_WEAPON], (!p->gotweapon[RPG_WEAPON]*9)+12-19* (cw == RPG_WEAPON)); } @@ -1697,7 +1697,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(127,184,127+29,184+6); //original code: (135,184,135+8,184+6); weaponnum(HANDBOMB_WEAPON,x+39,y+6, - p->ammo_amount[HANDBOMB_WEAPON],max_ammo_amount[HANDBOMB_WEAPON], + p->ammo_amount[HANDBOMB_WEAPON],p->max_ammo_amount[HANDBOMB_WEAPON], (((!p->ammo_amount[HANDBOMB_WEAPON])|(!p->gotweapon[HANDBOMB_WEAPON]))*9)+12-19* ((cw == HANDBOMB_WEAPON) || (cw == HANDREMOTE_WEAPON))); } @@ -1707,12 +1707,12 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) if (p->subweapon&(1<ammo_amount[GROW_WEAPON],max_ammo_amount[GROW_WEAPON], + p->ammo_amount[GROW_WEAPON],p->max_ammo_amount[GROW_WEAPON], (!p->gotweapon[GROW_WEAPON]*9)+12-18* (cw == GROW_WEAPON)); else weaponnum(SHRINKER_WEAPON,x+39,y+12, - p->ammo_amount[SHRINKER_WEAPON],max_ammo_amount[SHRINKER_WEAPON], + p->ammo_amount[SHRINKER_WEAPON],p->max_ammo_amount[SHRINKER_WEAPON], (!p->gotweapon[SHRINKER_WEAPON]*9)+12-18* (cw == SHRINKER_WEAPON)); } @@ -1721,7 +1721,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) if (u != -1) patchstatusbar(158,178,162+29,178+6); //original code: (166,178,166+8,178+6); weaponnum(DEVISTATOR_WEAPON,x+70,y, - p->ammo_amount[DEVISTATOR_WEAPON],max_ammo_amount[DEVISTATOR_WEAPON], + p->ammo_amount[DEVISTATOR_WEAPON],p->max_ammo_amount[DEVISTATOR_WEAPON], (!p->gotweapon[DEVISTATOR_WEAPON]*9)+12-18* (cw == DEVISTATOR_WEAPON)); } @@ -1730,7 +1730,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) if (u != -1) patchstatusbar(158,184,162+29,184+6); //original code: (166,184,166+8,184+6); weaponnum(TRIPBOMB_WEAPON,x+70,y+6, - p->ammo_amount[TRIPBOMB_WEAPON],max_ammo_amount[TRIPBOMB_WEAPON], + p->ammo_amount[TRIPBOMB_WEAPON],p->max_ammo_amount[TRIPBOMB_WEAPON], (!p->gotweapon[TRIPBOMB_WEAPON]*9)+12-18* (cw == TRIPBOMB_WEAPON)); } @@ -1740,7 +1740,7 @@ static void weapon_amounts(player_struct *p,long x,long y,long u) if (u != -1) patchstatusbar(158,190,162+29,190+6); //original code: (166,190,166+8,190+6); weaponnum(-1,x+70,y+12, - p->ammo_amount[FREEZE_WEAPON],max_ammo_amount[FREEZE_WEAPON], + p->ammo_amount[FREEZE_WEAPON],p->max_ammo_amount[FREEZE_WEAPON], (!p->gotweapon[FREEZE_WEAPON]*9)+12-18* (cw == FREEZE_WEAPON)); } @@ -7190,7 +7190,7 @@ void CheatGetInventory(void) GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex); } - SetGameVarID(g_iReturnVarID, max_player_health, g_player[myconnectindex].ps->i, myconnectindex); + SetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps->max_player_health, g_player[myconnectindex].ps->i, myconnectindex); OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps->i, myconnectindex, -1); if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0) { @@ -7280,7 +7280,7 @@ FOUNDCHEAT: for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) { - addammo(weapon, g_player[myconnectindex].ps, max_ammo_amount[weapon]); + addammo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); g_player[myconnectindex].ps->gotweapon[weapon] = 1; } @@ -7361,13 +7361,13 @@ FOUNDCHEAT: else { ud.god = 0; - sprite[g_player[myconnectindex].ps->i].extra = max_player_health; + sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; hittype[g_player[myconnectindex].ps->i].extra = -1; - g_player[myconnectindex].ps->last_extra = max_player_health; + g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; FTA(18,g_player[myconnectindex].ps); } - sprite[g_player[myconnectindex].ps->i].extra = max_player_health; + sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; hittype[g_player[myconnectindex].ps->i].extra = 0; g_player[myconnectindex].ps->cheat_phase = 0; KB_FlushKeyBoardQueue(); @@ -7401,18 +7401,18 @@ FOUNDCHEAT: for (weapon = PISTOL_WEAPON; weapon < (MAX_WEAPONS); weapon++) - addammo(weapon, g_player[myconnectindex].ps, max_ammo_amount[weapon]); + addammo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); g_player[myconnectindex].ps->got_access = 7; } else { - sprite[g_player[myconnectindex].ps->i].extra = max_player_health; + sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; hittype[g_player[myconnectindex].ps->i].extra = -1; - g_player[myconnectindex].ps->last_extra = max_player_health; + g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; FTA(18,g_player[myconnectindex].ps); } - sprite[g_player[myconnectindex].ps->i].extra = max_player_health; + sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; hittype[g_player[myconnectindex].ps->i].extra = 0; g_player[myconnectindex].ps->cheat_phase = 0; KB_FlushKeyBoardQueue(); @@ -7432,7 +7432,7 @@ FOUNDCHEAT: for (weapon = PISTOL_WEAPON; weapon < (MAX_WEAPONS-j); weapon++) - addammo(weapon, g_player[myconnectindex].ps, max_ammo_amount[weapon]); + addammo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); CheatGetInventory(); g_player[myconnectindex].ps->got_access = 7; FTA(5,g_player[myconnectindex].ps); @@ -10147,10 +10147,10 @@ void app_main(int argc,const char **argv) if (numplayers > 1) ud.multimode = numplayers; - for (i=1;ipalette = (char *) &palette[0]; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 0f703f593..69c131181 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -693,6 +693,9 @@ LABELS playerlabels[]= { "sound_pitch", PLAYER_SOUND_PITCH, 0, 0 }, { "weaponswitch", PLAYER_WEAPONSWITCH, 0, 0 }, { "team", PLAYER_TEAM, 0, 0 }, + { "max_player_health", PLAYER_MAX_PLAYER_HEALTH, 0, 0 }, + { "max_shield_amount", PLAYER_MAX_SHIELD_AMOUNT, 0, 0 }, + { "max_ammo_amount", PLAYER_MAX_AMMO_AMOUNT, LABEL_HASPARM2, MAX_WEAPONS }, { "", -1, 0, 0 } // END OF LIST }; @@ -4414,8 +4417,8 @@ repeatcase: j = 0; ud.const_visibility = params[j++]; impact_damage = params[j++]; - max_player_health = params[j++]; - max_armour_amount = params[j++]; + g_player[0].ps->max_player_health = g_player[0].ps->max_shield_amount = params[j++]; + start_armour_amount = params[j++]; respawnactortime = params[j++]; respawnitemtime = params[j++]; dukefriction = params[j++]; @@ -4427,16 +4430,16 @@ repeatcase: morterblastradius = params[j++]; bouncemineblastradius = params[j++]; seenineblastradius = params[j++]; - max_ammo_amount[PISTOL_WEAPON] = params[j++]; - max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; - max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; - max_ammo_amount[RPG_WEAPON] = params[j++]; - max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; - max_ammo_amount[SHRINKER_WEAPON] = params[j++]; - max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; - max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; - max_ammo_amount[FREEZE_WEAPON] = params[j++]; - if (g_ScriptVersion == 14) max_ammo_amount[GROW_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[PISTOL_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[RPG_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[SHRINKER_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; + g_player[0].ps->max_ammo_amount[FREEZE_WEAPON] = params[j++]; + if (g_ScriptVersion == 14) g_player[0].ps->max_ammo_amount[GROW_WEAPON] = params[j++]; camerashitable = params[j++]; numfreezebounces = params[j++]; freezerhurtowner = params[j++]; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 8d9da49ac..34a814348 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -56,13 +56,22 @@ extern char cheatquotes[][MAXCHEATLEN]; extern char compilefile[BMAX_PATH]; extern int total_lines,line_number; extern int error,warning; -typedef struct _labels { +typedef struct _labels +{ char *name; long lId; int flags; int maxParm2; } LABELS; +extern LABELS sectorlabels[]; +extern LABELS walllabels[]; +extern LABELS actorlabels[]; +extern LABELS playerlabels[]; +extern LABELS projectilelabels[]; +extern LABELS userdeflabels[]; +extern LABELS inputlabels[]; + enum errors { ERROR_CLOSEBRACKET, @@ -85,7 +94,8 @@ enum errors WARNING_LABELSONLY, }; -enum playerlabels { +enum playerlabels +{ PLAYER_ZOOM, PLAYER_EXITX, PLAYER_EXITY, @@ -227,10 +237,14 @@ enum playerlabels { PLAYER_MOVEMENT_LOCK, PLAYER_SOUND_PITCH, PLAYER_WEAPONSWITCH, - PLAYER_TEAM + PLAYER_TEAM, + PLAYER_MAX_PLAYER_HEALTH, + PLAYER_MAX_SHIELD_AMOUNT, + PLAYER_MAX_AMMO_AMOUNT }; -enum userdefslabels { +enum userdefslabels +{ USERDEFS_GOD, USERDEFS_WARP_ON, USERDEFS_CASHMAN, @@ -321,7 +335,8 @@ enum userdefslabels { USERDEFS_DEATHMSGS }; -enum sectorlabels { +enum sectorlabels +{ SECTOR_WALLPTR, SECTOR_WALLNUM, SECTOR_CEILINGZ, @@ -347,7 +362,8 @@ enum sectorlabels { SECTOR_EXTRA }; -enum walllabels { +enum walllabels +{ WALL_X, WALL_Y, WALL_POINT2, @@ -367,7 +383,8 @@ enum walllabels { WALL_EXTRA }; -enum actorlabels { +enum actorlabels +{ ACTOR_X, ACTOR_Y, ACTOR_Z, @@ -418,7 +435,8 @@ enum actorlabels { ACTOR_MDFLAGS }; -enum inputlabels { +enum inputlabels +{ INPUT_AVEL, INPUT_HORZ, INPUT_FVEL, @@ -427,7 +445,8 @@ enum inputlabels { INPUT_EXTBITS }; -enum projectilelabels { +enum projectilelabels +{ PROJ_WORKSLIKE, PROJ_SPAWNS, PROJ_SXREPEAT, @@ -458,7 +477,8 @@ enum projectilelabels { PROJ_RANGE // 28 }; -enum keywords { +enum keywords +{ CON_DEFINELEVELNAME, // 0 CON_ACTOR, // 1 CON_ADDAMMO, // 2 diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 1ce295e25..7acc02d14 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1953,6 +1953,28 @@ static void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2) SetGameVarID(lVar2, g_player[iPlayer].ps->team, g_i, g_p); break; + case PLAYER_MAX_PLAYER_HEALTH: + if (iSet) + g_player[iPlayer].ps->max_player_health = lValue; + else + SetGameVarID(lVar2, g_player[iPlayer].ps->max_player_health, g_i, g_p); + break; + + case PLAYER_MAX_SHIELD_AMOUNT: + if (iSet) + g_player[iPlayer].ps->max_shield_amount = lValue; + else + SetGameVarID(lVar2, g_player[iPlayer].ps->max_shield_amount, g_i, g_p); + break; + + case PLAYER_MAX_AMMO_AMOUNT: + lTemp=lParm2; + if (iSet) + g_player[iPlayer].ps->max_ammo_amount[lTemp]=lValue; + else + SetGameVarID(lVar2, g_player[iPlayer].ps->max_ammo_amount[lTemp], g_i, g_p); + break; + default: break; } @@ -3962,7 +3984,7 @@ static int parse(void) return 1; case CON_ADDAMMO: insptr++; - if (g_player[g_p].ps->ammo_amount[*insptr] >= max_ammo_amount[*insptr]) + if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr]) { killit_flag = 2; break; @@ -4020,7 +4042,7 @@ static int parse(void) if (!(g_player[g_p].ps->weaponswitch & 1)) addweaponnoswitch(g_player[g_p].ps, *insptr); else addweapon(g_player[g_p].ps, *insptr); } - else if (g_player[g_p].ps->ammo_amount[*insptr] >= max_ammo_amount[*insptr]) + else if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr]) { killit_flag = 2; break; @@ -4073,7 +4095,7 @@ static int parse(void) if (g_sp->picnum != ATOMICHEALTH) { - if (j > max_player_health && *insptr > 0) + if (j > g_player[g_p].ps->max_player_health && *insptr > 0) { insptr++; break; @@ -4082,16 +4104,16 @@ static int parse(void) { if (j > 0) j += *insptr; - if (j > max_player_health && *insptr > 0) - j = max_player_health; + if (j > g_player[g_p].ps->max_player_health && *insptr > 0) + j = g_player[g_p].ps->max_player_health; } } else { if (j > 0) j += *insptr; - if (j > (max_player_health<<1)) - j = (max_player_health<<1); + if (j > (g_player[g_p].ps->max_player_health<<1)) + j = (g_player[g_p].ps->max_player_health<<1); } if (j < 0) j = 0; @@ -4100,8 +4122,8 @@ static int parse(void) { if (*insptr > 0) { - if ((j - *insptr) < (max_player_health>>2) && - j >= (max_player_health>>2)) + if ((j - *insptr) < (g_player[g_p].ps->max_player_health>>2) && + j >= (g_player[g_p].ps->max_player_health>>2)) spritesound(DUKE_GOTHEALTHATLOW,g_player[g_p].ps->i); g_player[g_p].ps->last_extra = j; @@ -4144,7 +4166,7 @@ static int parse(void) if (!(g_player[g_p].ps->weaponswitch & 1)) addweaponnoswitch(g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); else addweapon(g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); } - else if (g_player[g_p].ps->ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)]) + else if (g_player[g_p].ps->ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= g_player[g_p].ps->max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)]) { killit_flag = 2; break; @@ -5131,7 +5153,7 @@ static int parse(void) g_sp->xoffset = 0; g_sp->pal = g_player[g_p].ps->palookup; - g_player[g_p].ps->last_extra = g_sp->extra = max_player_health; + g_player[g_p].ps->last_extra = g_sp->extra = g_player[g_p].ps->max_player_health; g_player[g_p].ps->wantweaponfire = -1; g_player[g_p].ps->horiz = 100; g_player[g_p].ps->on_crane = -1; @@ -5139,7 +5161,7 @@ static int parse(void) g_player[g_p].ps->horizoff = 0; g_player[g_p].ps->opyoff = 0; g_player[g_p].ps->wackedbyactor = -1; - g_player[g_p].ps->shield_amount = max_armour_amount; + g_player[g_p].ps->shield_amount = start_armour_amount; g_player[g_p].ps->dead_flag = 0; g_player[g_p].ps->pals_time = 0; g_player[g_p].ps->footprintcount = 0; @@ -5211,8 +5233,8 @@ static int parse(void) case GET_SHIELD: g_player[g_p].ps->shield_amount += *insptr;// 100; - if (g_player[g_p].ps->shield_amount > max_player_health) - g_player[g_p].ps->shield_amount = max_player_health; + if (g_player[g_p].ps->shield_amount > g_player[g_p].ps->max_shield_amount) + g_player[g_p].ps->shield_amount = g_player[g_p].ps->max_shield_amount; break; case GET_SCUBA: @@ -5732,22 +5754,11 @@ static int parse(void) { // syntax [gs]etplayer[].x // - int lVar1=*insptr++, lLabelID=*insptr++, lParm2, lVar2; + int lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2; // HACK: need to have access to labels structure at run-time... - switch (lLabelID) - { - case PLAYER_AMMO_AMOUNT: - case PLAYER_GOTWEAPON: - case PLAYER_PALS: - case PLAYER_LOOGIEX: - case PLAYER_LOOGIEY: + if (playerlabels[lLabelID].flags & LABEL_HASPARM2) lParm2=GetGameVarID(*insptr++, g_i, g_p); - break; - default: - lParm2=0; - break; - } lVar2=*insptr++; DoPlayer(tw==CON_SETPLAYER, lVar1, lLabelID, lVar2, lParm2); @@ -5851,17 +5862,10 @@ static int parse(void) // syntax [gs]etactor[].x // - int lVar1=*insptr++, lLabelID=*insptr++, lParm2, lVar2; + int lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2; - switch (lLabelID) - { - case ACTOR_HTG_T: + if (actorlabels[lLabelID].flags & LABEL_HASPARM2) lParm2=GetGameVarID(*insptr++, g_i, g_p); - break; - default: - lParm2=0; - break; - } lVar2=*insptr++; DoActor(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, lParm2); @@ -6003,13 +6007,13 @@ static int parse(void) case CON_GMAXAMMO: insptr++; j=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(*insptr++, max_ammo_amount[j], g_i, g_p); + SetGameVarID(*insptr++, g_player[g_p].ps->max_ammo_amount[j], g_i, g_p); break; case CON_SMAXAMMO: insptr++; j=GetGameVarID(*insptr++, g_i, g_p); - max_ammo_amount[j]=GetGameVarID(*insptr++, g_i, g_p); + g_player[g_p].ps->max_ammo_amount[j]=GetGameVarID(*insptr++, g_i, g_p); break; case CON_MULVARVAR: @@ -6137,7 +6141,7 @@ static int parse(void) case CON_STARTTRACK: insptr++; - music_select=*insptr++; + music_select=(ud.volume_number*MAXLEVELS)+(*(insptr++)); if (map[(unsigned char)music_select].musicfn != NULL) playmusic(&map[(unsigned char)music_select].musicfn[0]); break; @@ -6262,7 +6266,7 @@ static int parse(void) j = 1; break; case GET_SHIELD: - if (g_player[g_p].ps->shield_amount != max_player_health) + if (g_player[g_p].ps->shield_amount != g_player[g_p].ps->max_shield_amount) j = 1; break; case GET_SCUBA: diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 453123573..5c7c65bbd 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -28,7 +28,7 @@ char MusicPtr[72000*2]; short global_random; short neartagsector, neartagwall, neartagsprite; -long neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo_amount[MAX_WEAPONS]; +long neartaghitdist,lockclock,start_armour_amount; // JBF: gc modified to default to Atomic ed. default when using 1.3d CONs long gc=176; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 50a552fc0..56e50b6ad 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -781,7 +781,7 @@ static int osdcmd_give(const osdfuncparm_t *parm) } else if (!Bstrcasecmp(parm->parms[0], "health")) { - sprite[g_player[myconnectindex].ps->i].extra = 200; + sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health<<1; return OSDCMD_OK; } else if (!Bstrcasecmp(parm->parms[0], "weapons")) @@ -793,7 +793,7 @@ static int osdcmd_give(const osdfuncparm_t *parm) { for (i=PISTOL_WEAPON;imax_ammo_amount[i]); } return OSDCMD_OK; } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index f566f785a..51bc96d54 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -512,7 +512,7 @@ int shoot(int i,int atwith) } if (p >= 0 && g_player[p].ps->steroids_amount > 0 && g_player[p].ps->steroids_amount < 400) - sprite[j].extra += (max_player_health>>2); + sprite[j].extra += (g_player[p].ps->max_player_health>>2); if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) { @@ -1076,7 +1076,7 @@ DOSKIPBULLETHOLE: } if (p >= 0 && g_player[p].ps->steroids_amount > 0 && g_player[p].ps->steroids_amount < 400) - sprite[j].extra += (max_player_health>>2); + sprite[j].extra += (g_player[p].ps->max_player_health>>2); if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) { @@ -3179,7 +3179,7 @@ static int doincrements(player_struct *p) else { p->extra_extra8 += 32; - if (p->last_extra < (max_player_health>>1) && (p->last_extra&3) == 0) + if (p->last_extra < (p->max_player_health>>1) && (p->last_extra&3) == 0) spritesound(DUKE_LONGTERM_PAIN,p->i); } } @@ -5123,41 +5123,41 @@ int getspritescore(long snum, long dapicnum) return(120); case FREEZEAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); + if (g_player[snum].ps->ammo_amount[FREEZE_WEAPON] < g_player[snum].ps->max_ammo_amount[FREEZE_WEAPON]) return(10); return(1); case AMMO__STATIC: - if (g_player[snum].ps->ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10); + if (g_player[snum].ps->ammo_amount[PISTOL_WEAPON] < g_player[snum].ps->max_ammo_amount[PISTOL_WEAPON]) return(10); return(1); case BATTERYAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20); + if (g_player[snum].ps->ammo_amount[CHAINGUN_WEAPON] < g_player[snum].ps->max_ammo_amount[CHAINGUN_WEAPON]) return(20); return(1); case DEVISTATORAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25); + if (g_player[snum].ps->ammo_amount[DEVISTATOR_WEAPON] < g_player[snum].ps->max_ammo_amount[DEVISTATOR_WEAPON]) return(25); return(1); case RPGAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50); + if (g_player[snum].ps->ammo_amount[RPG_WEAPON] < g_player[snum].ps->max_ammo_amount[RPG_WEAPON]) return(50); return(1); case CRYSTALAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10); + if (g_player[snum].ps->ammo_amount[SHRINKER_WEAPON] < g_player[snum].ps->max_ammo_amount[SHRINKER_WEAPON]) return(10); return(1); case HBOMBAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30); + if (g_player[snum].ps->ammo_amount[HANDBOMB_WEAPON] < g_player[snum].ps->max_ammo_amount[HANDBOMB_WEAPON]) return(30); return(1); case SHOTGUNAMMO__STATIC: - if (g_player[snum].ps->ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25); + if (g_player[snum].ps->ammo_amount[SHOTGUN_WEAPON] < g_player[snum].ps->max_ammo_amount[SHOTGUN_WEAPON]) return(25); return(1); case COLA__STATIC: - if (sprite[g_player[snum].ps->i].extra < 100) return(10); + if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(10); return(1); case SIXPAK__STATIC: - if (sprite[g_player[snum].ps->i].extra < 100) return(30); + if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(30); return(1); case FIRSTAID__STATIC: - if (g_player[snum].ps->firstaid_amount < 100) return(100); + if (g_player[snum].ps->firstaid_amount < g_player[snum].ps->max_player_health) return(100); return(1); case SHIELD__STATIC: - if (g_player[snum].ps->shield_amount < 100) return(50); + if (g_player[snum].ps->shield_amount < g_player[snum].ps->max_shield_amount) return(50); return(1); case STEROIDS__STATIC: if (g_player[snum].ps->steroids_amount < 400) return(30); @@ -5177,7 +5177,7 @@ int getspritescore(long snum, long dapicnum) if (g_player[snum].ps->boot_amount < 200) return(15); return(1); case ATOMICHEALTH__STATIC: - if (sprite[g_player[snum].ps->i].extra < max_player_health<<1) return(50); + if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health<<1) return(50); return(1); case HOLODUKE__STATIC: if (g_player[snum].ps->holoduke_amount < 2400) return(5); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index e33983d3d..2cb21916d 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -720,7 +720,7 @@ void resetinventory(int snum) p->heat_on = 0; p->jetpack_on = 0; p->jetpack_amount = 0; - p->shield_amount = max_armour_amount; + p->shield_amount = start_armour_amount; p->holoduke_on = -1; p->holoduke_amount = 0; p->firstaid_amount = 0; @@ -1381,8 +1381,8 @@ static void resetpspritevars(char g) if ((g&MODE_EOL) != MODE_EOL || g_player[j].ps->last_extra == 0) { - g_player[j].ps->last_extra = max_player_health; - s->extra = max_player_health; + g_player[j].ps->last_extra = g_player[j].ps->max_player_health; + s->extra = g_player[j].ps->max_player_health; g_player[j].ps->runspeed = dukefriction; } else s->extra = g_player[j].ps->last_extra; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 8126c3c8e..6c05ee496 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" -#define BYTEVERSION_COMPAT (BYTEVERSION-3) - void readsavenames(void) { long dummy,j; @@ -54,7 +52,7 @@ void readsavenames(void) Bfclose(fil); continue; } - if (dummy != BYTEVERSION && dummy != BYTEVERSION_COMPAT) + if (dummy != BYTEVERSION) { Bfclose(fil); continue; @@ -91,7 +89,7 @@ int loadpheader(char spot,struct savehead *saveh) // AddLog(g_szBuf); if (kdfread(&bv,4,1,fil) != 1) goto corrupt; - if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT) + if (bv != BYTEVERSION) { FTA(114,g_player[myconnectindex].ps); kclose(fil); @@ -168,7 +166,7 @@ int loadplayer(int spot) // AddLog(g_szBuf); if (kdfread(&bv,4,1,fil) != 1) return -1; - if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT) + if (bv != BYTEVERSION) { FTA(114,g_player[myconnectindex].ps); kclose(fil); diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index cc34b69c8..9da8968a4 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -3096,14 +3096,14 @@ CHECKINV1: OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum, -1); if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0) { - if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health) + if (p->firstaid_amount > 0 && sprite[p->i].extra < p->max_player_health) { - j = max_player_health-sprite[p->i].extra; + j = p->max_player_health-sprite[p->i].extra; if ((unsigned long)p->firstaid_amount > j) { p->firstaid_amount -= j; - sprite[p->i].extra = max_player_health; + sprite[p->i].extra = p->max_player_health; p->inven_icon = 1; } else @@ -3383,13 +3383,13 @@ void checksectors(int snum) p->holster_weapon = 1; p->weapon_pos = -1; } - if (sprite[p->i].extra <= (max_player_health-(max_player_health/10))) + if (sprite[p->i].extra <= (p->max_player_health-(p->max_player_health/10))) { - sprite[p->i].extra += max_player_health/10; + sprite[p->i].extra += p->max_player_health/10; p->last_extra = sprite[p->i].extra; } - else if (sprite[p->i].extra < max_player_health) - sprite[p->i].extra = max_player_health; + else if (sprite[p->i].extra < p->max_player_health) + sprite[p->i].extra = p->max_player_health; } else if (!isspritemakingsound(neartagsprite,FLUSH_TOILET)) spritesound(FLUSH_TOILET,neartagsprite); @@ -3423,7 +3423,7 @@ void checksectors(int snum) hittype[neartagsprite].temp_data[0] = 1; sprite[neartagsprite].owner = p->i; - if (sprite[p->i].extra < max_player_health) + if (sprite[p->i].extra < p->max_player_health) { sprite[p->i].extra++; spritesound(DUKE_DRINKING,p->i);