From 2efba665586399249f76e17b9c9f17d6c512552d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 24 Oct 2006 02:32:12 +0000 Subject: [PATCH] - Added the A_JumpSet function for what seems to be a fairly common scenario. It is like A_Jump, except it accepts up to 20 jump targets. The jump probability is still the first parameter and controls whether any jump is taken at all; use 256 if you always want to jump. If a jump is taken, then one of the jump targets will be chosen at random, with each target having an equal chance of being chosen. - Fixed: The unfreeze ccmd was not multiplayer-safe. And I renamed it to thaw, since it has nothing to do with the freeze ccmd. SVN r360 (trunk) --- docs/rh-log.txt | 10 ++++++++++ src/c_cmds.cpp | 8 ++++++-- src/d_protocol.h | 1 + src/m_cheat.cpp | 5 +++++ src/thingdef.cpp | 2 ++ src/thingdef_codeptr.cpp | 22 ++++++++++++++++++++++ 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0d1a29a60..f184dd015 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,13 @@ +October 23, 2006 +- Added the A_JumpSet function for what seems to be a fairly common scenario. + It is like A_Jump, except it accepts up to 20 jump targets. The jump + probability is still the first parameter and controls whether any jump is + taken at all; use 256 if you always want to jump. If a jump is taken, then + one of the jump targets will be chosen at random, with each target having + an equal chance of being chosen. +- Fixed: The unfreeze ccmd was not multiplayer-safe. And I renamed it to thaw, + since it has nothing to do with the freeze ccmd. + October 22, 2006 (Changes by Graf Zahl) - Added MF5_PIERCEARMOR flag that allows damaging objects that aren't affected by armor. diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 607c1705c..e80ee975b 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -817,7 +817,11 @@ CCMD(changesky) // // //----------------------------------------------------------------------------- -CCMD(unfreeze) +CCMD(thaw) { - if (who != NULL) who->player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN); + if (CheckCheatmode()) + return; + + Net_WriteByte (DEM_GENERICCHEAT); + Net_WriteByte (CHT_CLEARFROZENPROPS); } diff --git a/src/d_protocol.h b/src/d_protocol.h index 0443f7359..e7642b814 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -183,6 +183,7 @@ enum ECheatCommand CHT_DONNYTRUMP, CHT_LEGO, CHT_RESSURECT, // [GRB] + CHT_CLEARFROZENPROPS, }; void StartChunk (int id, BYTE **stream); diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index d4377d73f..f2a9feca9 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -399,6 +399,11 @@ void cht_DoCheat (player_t *player, int cheat) cht_Give (player, "UpgradeAccuracy"); msg = "you got the stuff!"; break; + + case CHT_CLEARFROZENPROPS: + player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN); + msg = "Frozen player properties turned off"; + break; } if (!*msg) // [SO] Don't print blank lines! diff --git a/src/thingdef.cpp b/src/thingdef.cpp index 32f3b87dd..e8955483c 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -457,6 +457,7 @@ ACTOR(PlaySoundEx) ACTOR(StopSoundEx) ACTOR(SeekerMissile) ACTOR(Jump) +ACTOR(JumpSet) ACTOR(ExplodeParms) ACTOR(CallSpecial) ACTOR(CustomMissile) @@ -677,6 +678,7 @@ AFuncDesc AFTable[]= FUNC(A_StopSoundEx, "T" ) FUNC(A_SeekerMissile, "XX" ) FUNC(A_Jump, "XL" ) + FUNC(A_JumpSet, "XLLllllllllllllllllll") FUNC(A_CustomMissile, "MXXxxx" ) FUNC(A_CustomBulletAttack, "XXXXmx" ) FUNC(A_CustomRailgun, "Xxccxxx" ) diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index db7af7214..37441cbda 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -413,6 +413,28 @@ void A_Jump(AActor * self) if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! } +//========================================================================== +// +// State jump function +// +//========================================================================== +void A_JumpSet(AActor * self) +{ + FState * CallingState; + int index=CheckIndex(21, &CallingState); + int i; + + if (index>=0 && pr_cajump() < clamp(EvalExpressionI (StateParameters[index], self), 0, 256)) + { + // Find out how many targets are actually used + for (i = 0; i < 20 && StateParameters[index+i+1] != 0; ++i) + { } + DoJump(self, CallingState, StateParameters[index + (pr_cajump() % i) + 1]); + } + + if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! +} + //========================================================================== // // State jump function