From f94cdaf782675d35b12852239f8dd4c24059d425 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Jul 2006 22:56:20 +0000 Subject: [PATCH] - Added Grubber's GetPlayerInfo ACS function. SVN r276 (trunk) --- docs/rh-log.txt | 1 + src/p_acs.cpp | 24 ++++++++++++++++++++++++ src/p_acs.h | 11 +++++++++++ 3 files changed, 36 insertions(+) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 996ce6466..1abb7c0ec 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ July 30, 2006 (Changes by Graf Zahl) +- Added Grubber's GetPlayerInfo ACS function. - Fixed: Starting a game without skill menu always started the first episode. - Changed A_AlertMonsters so that it can be placed directly in a weapon state. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 94f197a66..143c4caa0 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4853,6 +4853,30 @@ int DLevelScript::RunScript () } break; + case PCD_GETPLAYERINFO: // [GRB] + if (STACK(2) < 0 || STACK(2) >= MAXPLAYERS || !playeringame[STACK(2)]) + { + STACK(2) = -1; + } + else + { + userinfo_t *userinfo = &players[STACK(2)].userinfo; + switch (STACK(1)) + { + case PLAYERINFO_TEAM: STACK(2) = userinfo->team; + case PLAYERINFO_AIMDIST: STACK(2) = userinfo->aimdist; + case PLAYERINFO_COLOR: STACK(2) = userinfo->color; + case PLAYERINFO_GENDER: STACK(2) = userinfo->gender; + case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->neverswitch; + case PLAYERINFO_MOVEBOB: STACK(2) = userinfo->MoveBob; + case PLAYERINFO_STILLBOB: STACK(2) = userinfo->StillBob; + case PLAYERINFO_PLAYERCLASS: STACK(2) = userinfo->PlayerClass; + default: STACK(2) = 0; + } + } + sp -= 1; + break; + } } diff --git a/src/p_acs.h b/src/p_acs.h index 7b21067ae..230c2fe28 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -531,6 +531,7 @@ public: PCD_RSWORLDARRAY, PCD_RSGLOBALARRAY, //[MW] end my p-codes + PCD_GETPLAYERINFO, // [GRB] PCODE_COMMAND_COUNT }; @@ -585,6 +586,16 @@ public: LEVELINFO_KILLED_MONSTERS, LEVELINFO_SUCK_TIME }; + enum { + PLAYERINFO_TEAM, + PLAYERINFO_AIMDIST, + PLAYERINFO_COLOR, + PLAYERINFO_GENDER, + PLAYERINFO_NEVERSWITCH, + PLAYERINFO_MOVEBOB, + PLAYERINFO_STILLBOB, + PLAYERINFO_PLAYERCLASS + }; enum EScriptState {