diff --git a/src/actor.h b/src/actor.h index 374dc9b895..96aa7efd2f 100644 --- a/src/actor.h +++ b/src/actor.h @@ -851,6 +851,8 @@ public: int special; // special int args[5]; // special arguments + int accuracy, stamina; // [RH] Strife stats -- [XA] moved here for DECORATE/ACS access. + AActor *inext, **iprev;// Links to other mobjs in same bucket TObjPtr goal; // Monster's goal if not chasing anything int waterlevel; // 0=none, 1=feet, 2=waist, 3=eyes diff --git a/src/d_player.h b/src/d_player.h index 2b9c7b2f23..7781046f8d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -330,8 +330,6 @@ public: int air_finished; // [RH] Time when you start drowning - WORD accuracy, stamina; // [RH] Strife stats - FName LastDamageType; // [RH] For damage-specific pain and death sounds //Added by MC: diff --git a/src/g_level.cpp b/src/g_level.cpp index 97061852e7..194ebb8881 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1367,12 +1367,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) << level.aircontrol << level.teamdamage << level.maptime - << i; - - if (SaveVersion >= 3313) - { - arc << level.nextmusic; - } + << i + << level.nextmusic; // Hub transitions must keep the current total time if (!hubLoad) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index a97fc0acba..0499b51b1b 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1301,8 +1301,8 @@ void APowerTargeter::PositionAccuracy () if (player != NULL) { - player->psprites[ps_targetleft].sx = (160-3)*FRACUNIT - ((100 - player->accuracy) << FRACBITS); - player->psprites[ps_targetright].sx = (160-3)*FRACUNIT + ((100 - player->accuracy) << FRACBITS); + player->psprites[ps_targetleft].sx = (160-3)*FRACUNIT - ((100 - player->mo->accuracy) << FRACBITS); + player->psprites[ps_targetright].sx = (160-3)*FRACUNIT + ((100 - player->mo->accuracy) << FRACBITS); } } diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index e7c598d3e8..80e83e1e4c 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -44,26 +44,6 @@ void DLightningThinker::Serialize (FArchive &arc) arc << Stopped << NextLightningFlash << LightningFlashCount; - if (SaveVersion < 3243) - { - // Do nothing with old savegames and just keep whatever the constructor made - // but read the obsolete data from the savegame - for (i = (numsectors + (numsectors+7)/8); i > 0; --i) - { - if (SaveVersion < 3223) - { - BYTE bytelight; - arc << bytelight; - } - else - { - short shortlight; - arc << shortlight; - } - } - return; - } - if (arc.IsLoading ()) { if (LightningLightLevels != NULL) diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 7075aeb872..a9b7a64a57 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -188,7 +188,7 @@ bool P_GiveBody (AActor *actor, int num) num = clamp(num, -65536, 65536); // prevent overflows for bad values if (player != NULL) { - max = static_cast(actor)->GetMaxHealth() + player->stamina; + max = static_cast(actor)->GetMaxHealth() + player->mo->stamina; // [MH] First step in predictable generic morph effects if (player->morphTics) { @@ -196,7 +196,7 @@ bool P_GiveBody (AActor *actor, int num) { if (!(player->MorphStyle & MORPH_ADDSTAMINA)) { - max -= player->stamina; + max -= player->mo->stamina; } } else // old health behaviour @@ -204,7 +204,7 @@ bool P_GiveBody (AActor *actor, int num) max = MAXMORPHHEALTH; if (player->MorphStyle & MORPH_ADDSTAMINA) { - max += player->stamina; + max += player->mo->stamina; } } } @@ -1483,7 +1483,7 @@ bool AHealth::TryPickup (AActor *&other) PrevHealth = other->player->health; if (max == 0) { - max = static_cast(other)->GetMaxHealth() + player->stamina; + max = static_cast(other)->GetMaxHealth() + player->mo->stamina; // [MH] First step in predictable generic morph effects if (player->morphTics) { @@ -1491,7 +1491,7 @@ bool AHealth::TryPickup (AActor *&other) { if (!(player->MorphStyle & MORPH_ADDSTAMINA)) { - max -= player->stamina; + max -= player->mo->stamina; } } else // old health behaviour @@ -1499,7 +1499,7 @@ bool AHealth::TryPickup (AActor *&other) max = MAXMORPHHEALTH; if (player->MorphStyle & MORPH_ADDSTAMINA) { - max += player->stamina; + max += player->mo->stamina; } } } diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index b68cd5d38b..b4ce895488 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1270,10 +1270,10 @@ class CommandDrawNumber : public CommandDrawString num = statusBar->CPlayer->mo->InvSel->Amount; break; case ACCURACY: - num = statusBar->CPlayer->accuracy; + num = statusBar->CPlayer->mo->accuracy; break; case STAMINA: - num = statusBar->CPlayer->stamina; + num = statusBar->CPlayer->mo->stamina; break; case KEYS: num = 0; @@ -2455,7 +2455,7 @@ class CommandDrawBar : public SBarInfoCommand max = 0; } else //default to the class's health - max = statusBar->CPlayer->mo->GetMaxHealth() + statusBar->CPlayer->stamina; + max = statusBar->CPlayer->mo->GetMaxHealth() + statusBar->CPlayer->mo->stamina; break; case ARMOR: value = statusBar->armor != NULL ? statusBar->armor->Amount : 0; @@ -2970,7 +2970,7 @@ class CommandDrawGem : public SBarInfoCommand void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged) { goalValue = armor ? statusBar->armor->Amount : statusBar->CPlayer->mo->health; - int max = armor ? 100 : statusBar->CPlayer->mo->GetMaxHealth() + statusBar->CPlayer->stamina; + int max = armor ? 100 : statusBar->CPlayer->mo->GetMaxHealth() + statusBar->CPlayer->mo->stamina; if(max != 0 && goalValue > 0) { goalValue = (goalValue*100)/max; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 72e780f52b..db3b264c73 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -230,9 +230,9 @@ static void DrawStatus(player_t * CPlayer, int x, int y) if (hud_showstats) { - mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->accuracy); + mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->mo->accuracy); DrawStatLine(x, y, "Ac:", tempstr); - mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->stamina); + mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->mo->stamina); DrawStatLine(x, y, "St:", tempstr); } diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index 06674a1ae6..5bf6c2caa7 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -82,7 +82,7 @@ bool AHealthTraining::TryPickup (AActor *&toucher) AInventory *coin = Spawn (0,0,0, NO_REPLACE); if (coin != NULL) { - coin->Amount = toucher->player->accuracy*5 + 300; + coin->Amount = toucher->player->mo->accuracy*5 + 300; if (!coin->CallTryPickup (toucher)) { coin->Destroy (); @@ -339,9 +339,9 @@ bool AUpgradeStamina::TryPickup (AActor *&toucher) if (toucher->player == NULL) return false; - toucher->player->stamina += Amount; - if (toucher->player->stamina >= MaxAmount) - toucher->player->stamina = MaxAmount; + toucher->player->mo->stamina += Amount; + if (toucher->player->mo->stamina >= MaxAmount) + toucher->player->mo->stamina = MaxAmount; P_GiveBody (toucher, -100); GoAwayAndDie (); @@ -354,9 +354,9 @@ IMPLEMENT_CLASS (AUpgradeAccuracy) bool AUpgradeAccuracy::TryPickup (AActor *&toucher) { - if (toucher->player == NULL || toucher->player->accuracy >= 100) + if (toucher->player == NULL || toucher->player->mo->accuracy >= 100) return false; - toucher->player->accuracy += 10; + toucher->player->mo->accuracy += 10; GoAwayAndDie (); return true; } diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index e7d24dc36c..957a5371af 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) int power; AActor *linetarget; - power = MIN(10, self->player->stamina / 10); + power = MIN(10, self->player->mo->stamina / 10); damage = (pr_jabdagger() % (power + 8)) * (power + 2); if (self->FindInventory()) @@ -237,7 +237,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow) if (ti) { savedangle = self->angle; - self->angle += pr_electric.Random2 () << (18 - self->player->accuracy * 5 / 100); + self->angle += pr_electric.Random2 () << (18 - self->player->mo->accuracy * 5 / 100); self->player->mo->PlayAttacking2 (); P_SpawnPlayerMissile (self, ti); self->angle = savedangle; @@ -263,7 +263,7 @@ void P_StrifeGunShot (AActor *mo, bool accurate, angle_t pitch) if (mo->player != NULL && !accurate) { - angle += pr_sgunshot.Random2() << (20 - mo->player->accuracy * 5 / 100); + angle += pr_sgunshot.Random2() << (20 - mo->player->mo->accuracy * 5 / 100); } P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, NAME_StrifePuff); @@ -324,7 +324,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile) } savedangle = self->angle; - self->angle += pr_minimissile.Random2() << (19 - player->accuracy * 5 / 100); + self->angle += pr_minimissile.Random2() << (19 - player->mo->accuracy * 5 / 100); player->mo->PlayAttacking2 (); P_SpawnPlayerMissile (self, PClass::FindClass("MiniMissile")); self->angle = savedangle; diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index 3db2274f1c..4792065f4c 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -664,8 +664,8 @@ private: // Show miscellaneous status items. // Print stats - DrINumber2 (CPlayer->accuracy, left+268*xscale, top+28*yscale, 7*xscale, imgFONY0); - DrINumber2 (CPlayer->stamina, left+268*xscale, top+52*yscale, 7*xscale, imgFONY0); + DrINumber2 (CPlayer->mo->accuracy, left+268*xscale, top+28*yscale, 7*xscale, imgFONY0); + DrINumber2 (CPlayer->mo->stamina, left+268*xscale, top+52*yscale, 7*xscale, imgFONY0); // How many keys does the player have? for (i = 0, item = CPlayer->mo->Inventory; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index ad11c9fd25..5d520ffb76 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2032,35 +2032,19 @@ void FBehavior::StaticStopMyScripts (AActor *actor) void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte) { - if (SaveVersion < 3359) + arc << scriptnum; + // If the script number is negative, then it's really a name. + // So read/store the name after it. + if (scriptnum < 0) { - if (was2byte) + if (arc.IsStoring()) { - WORD oldver; - arc << oldver; - scriptnum = oldver; + arc.WriteName(FName(ENamedName(-scriptnum)).GetChars()); } else { - arc << scriptnum; - } - } - else - { - arc << scriptnum; - // If the script number is negative, then it's really a name. - // So read/store the name after it. - if (scriptnum < 0) - { - if (arc.IsStoring()) - { - arc.WriteName(FName(ENamedName(-scriptnum)).GetChars()); - } - else - { - const char *nam = arc.ReadName(); - scriptnum = -FName(nam); - } + const char *nam = arc.ReadName(); + scriptnum = -FName(nam); } } } @@ -2819,6 +2803,8 @@ enum APROP_ScaleY = 30, APROP_Dormant = 31, APROP_Mass = 32, + APROP_Accuracy = 33, + APROP_Stamina = 34, }; // These are needed for ACS's APROP_RenderStyle @@ -3012,6 +2998,14 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) actor->Mass = value; break; + case APROP_Accuracy: + actor->accuracy = value; + break; + + case APROP_Stamina: + actor->stamina = value; + break; + default: // do nothing. break; @@ -3078,6 +3072,8 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_ScaleX: return actor->scaleX; case APROP_ScaleY: return actor->scaleY; case APROP_Mass: return actor->Mass; + case APROP_Accuracy: return actor->accuracy; + case APROP_Stamina: return actor->stamina; default: return 0; } @@ -3116,6 +3112,8 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value) case APROP_ScaleX: case APROP_ScaleY: case APROP_Mass: + case APROP_Accuracy: + case APROP_Stamina: return (GetActorProperty(tid, property) == value); // Boolean values need to compare to a binary version of value diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ddc304114d..68dbf27077 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -230,12 +230,9 @@ void AActor::Serialize (FArchive &arc) << velz << tics << state - << Damage; - if (SaveVersion >= 3227) - { - arc << projectileKickback; - } - arc << flags + << Damage + << projectileKickback + << flags << flags2 << flags3 << flags4 @@ -270,6 +267,8 @@ void AActor::Serialize (FArchive &arc) arc << args[0]; } arc << args[1] << args[2] << args[3] << args[4] + << accuracy + << stamina << goal << waterlevel << MinMissileChance @@ -305,14 +304,10 @@ void AActor::Serialize (FArchive &arc) << maxtargetrange << meleethreshold << meleerange - << DamageType; - if (SaveVersion >= 3237) - { - arc + << DamageType << PainType - << DeathType; - } - arc << gravity + << DeathType + << gravity << FastChaseStrafeCount << master << smokecounter @@ -321,22 +316,16 @@ void AActor::Serialize (FArchive &arc) << VisibleToTeam // [BB] << pushfactor << Species - << Score; - if (SaveVersion >= 3113) - { - arc << DesignatedTeam; - } - arc << lastpush << lastbump + << Score + << DesignatedTeam + << lastpush << lastbump << PainThreshold << DamageFactor << WeaveIndexXY << WeaveIndexZ << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner - << PoisonDamage << PoisonDuration << PoisonPeriod; - if (SaveVersion >= 3235) - { - arc << PoisonDamageType << PoisonDamageTypeReceived; - } - arc << ConversationRoot << Conversation; + << PoisonDamage << PoisonDuration << PoisonPeriod + << PoisonDamageType << PoisonDamageTypeReceived + << ConversationRoot << Conversation; { FString tagstr; diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 3b7533efc4..adadbac95a 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -326,18 +326,9 @@ void P_SerializeWorld (FArchive &arc) for (i = 0, sec = sectors; i < numsectors; i++, sec++) { arc << sec->floorplane - << sec->ceilingplane; - if (SaveVersion < 3223) - { - BYTE bytelight; - arc << bytelight; - sec->lightlevel = bytelight; - } - else - { - arc << sec->lightlevel; - } - arc << sec->special + << sec->ceilingplane + << sec->lightlevel + << sec->special << sec->tag << sec->soundtraversed << sec->seqType diff --git a/src/p_spec.cpp b/src/p_spec.cpp index a41fa2cad6..e1777cf46a 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -727,17 +727,7 @@ IMPLEMENT_CLASS (DLightTransfer) void DLightTransfer::Serialize (FArchive &arc) { Super::Serialize (arc); - if (SaveVersion < 3223) - { - BYTE bytelight; - arc << bytelight; - LastLight = bytelight; - } - else - { - arc << LastLight; - } - arc << Source << TargetTag << CopyFloor; + arc << LastLight << Source << TargetTag << CopyFloor; } DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor) @@ -820,17 +810,7 @@ IMPLEMENT_CLASS (DWallLightTransfer) void DWallLightTransfer::Serialize (FArchive &arc) { Super::Serialize (arc); - if (SaveVersion < 3223) - { - BYTE bytelight; - arc << bytelight; - LastLight = bytelight; - } - else - { - arc << LastLight; - } - arc << Source << TargetID << Flags; + arc << LastLight << Source << TargetID << Flags; } DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, BYTE flags) diff --git a/src/p_user.cpp b/src/p_user.cpp index 359a773499..9550039373 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -269,8 +269,6 @@ player_t::player_t() respawn_time(0), camera(0), air_finished(0), - accuracy(0), - stamina(0), savedyaw(0), savedpitch(0), angle(0), @@ -2616,7 +2614,6 @@ void player_t::Serialize (FArchive &arc) << BlendG << BlendB << BlendA - << accuracy << stamina << LogText << ConversationNPC << ConversationPC diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 426310652e..e18e0fba97 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -82,6 +82,8 @@ DEFINE_MEMBER_VARIABLE(scaleX, AActor) DEFINE_MEMBER_VARIABLE(scaleY, AActor) DEFINE_MEMBER_VARIABLE(Damage, AActor) DEFINE_MEMBER_VARIABLE(Score, AActor) +DEFINE_MEMBER_VARIABLE(accuracy, AActor) +DEFINE_MEMBER_VARIABLE(stamina, AActor) //========================================================================== // diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 0a3a6c9f37..ec68f8514b 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1257,6 +1257,24 @@ DEFINE_PROPERTY(visibletoplayerclass, S_s, Actor) } } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(accuracy, I, Actor) +{ + PROP_INT_PARM(i, 0); + defaults->accuracy = i; +} + +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(stamina, I, Actor) +{ + PROP_INT_PARM(i, 0); + defaults->stamina = i; +} + //========================================================================== // // Special inventory properties diff --git a/src/version.h b/src/version.h index ab877820df..524f494d73 100644 --- a/src/version.h +++ b/src/version.h @@ -75,7 +75,7 @@ // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 3100 +#define MINSAVEVER 3427 #if SVN_REVISION_NUMBER < MINSAVEVER // If we don't know the current revision write something very high to ensure that diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 1876ebb61c..1bc7f53a99 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -54,6 +54,8 @@ ACTOR Actor native //: Thinker native fixed_t scaleX; native fixed_t scaleY; native int score; + native int accuracy; + native int stamina; // Meh, MBF redundant functions. Only for DeHackEd support. action native A_Turn(float angle = 0);