diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f82982462..2516348de 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ July 16, 2006 (Changes by Graf Zahl) +- Added NecroMage's submission for bitwise/shift assignment operators for ACS. - Added replacement handling to A_BossDeath. - Fixed: The check for no skill menu was incorrect when a custom player class menu was present so instead of starting the game specific skill menu diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 785fec187..94f197a66 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3010,6 +3010,243 @@ int DLevelScript::RunScript () } break; + //[MW] start + case PCD_ANDSCRIPTVAR: + locals[NEXTBYTE] &= STACK(1); + sp--; + break; + + case PCD_ANDMAPVAR: + *(activeBehavior->MapVars[NEXTBYTE]) &= STACK(1); + sp--; + break; + + case PCD_ANDWORLDVAR: + ACS_WorldVars[NEXTBYTE] &= STACK(1); + sp--; + break; + + case PCD_ANDGLOBALVAR: + ACS_GlobalVars[NEXTBYTE] &= STACK(1); + sp--; + break; + + case PCD_ANDMAPARRAY: + { + int a = *(activeBehavior->MapVars[NEXTBYTE]); + int i = STACK(2); + activeBehavior->SetArrayVal (a, i, activeBehavior->GetArrayVal (a, i) & STACK(1)); + sp -= 2; + } + break; + + case PCD_ANDWORLDARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_WorldArrays[a].SetVal (i, ACS_WorldArrays[a].GetVal (i) & STACK(1)); + sp -= 2; + } + break; + + case PCD_ANDGLOBALARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_GlobalArrays[a].SetVal (i, ACS_GlobalArrays[a].GetVal (i) & STACK(1)); + sp -= 2; + } + break; + + case PCD_EORSCRIPTVAR: + locals[NEXTBYTE] ^= STACK(1); + sp--; + break; + + case PCD_EORMAPVAR: + *(activeBehavior->MapVars[NEXTBYTE]) ^= STACK(1); + sp--; + break; + + case PCD_EORWORLDVAR: + ACS_WorldVars[NEXTBYTE] ^= STACK(1); + sp--; + break; + + case PCD_EORGLOBALVAR: + ACS_GlobalVars[NEXTBYTE] ^= STACK(1); + sp--; + break; + + case PCD_EORMAPARRAY: + { + int a = *(activeBehavior->MapVars[NEXTBYTE]); + int i = STACK(2); + activeBehavior->SetArrayVal (a, i, activeBehavior->GetArrayVal (a, i) ^ STACK(1)); + sp -= 2; + } + break; + + case PCD_EORWORLDARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_WorldArrays[a].SetVal (i, ACS_WorldArrays[a].GetVal (i) ^ STACK(1)); + sp -= 2; + } + break; + + case PCD_EORGLOBALARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_GlobalArrays[a].SetVal (i, ACS_GlobalArrays[a].GetVal (i) ^ STACK(1)); + sp -= 2; + } + break; + + case PCD_ORSCRIPTVAR: + locals[NEXTBYTE] |= STACK(1); + sp--; + break; + + case PCD_ORMAPVAR: + *(activeBehavior->MapVars[NEXTBYTE]) |= STACK(1); + sp--; + break; + + case PCD_ORWORLDVAR: + ACS_WorldVars[NEXTBYTE] |= STACK(1); + sp--; + break; + + case PCD_ORGLOBALVAR: + ACS_GlobalVars[NEXTBYTE] |= STACK(1); + sp--; + break; + + case PCD_ORMAPARRAY: + { + int a = *(activeBehavior->MapVars[NEXTBYTE]); + int i = STACK(2); + activeBehavior->SetArrayVal (a, i, activeBehavior->GetArrayVal (a, i) | STACK(1)); + sp -= 2; + } + break; + + case PCD_ORWORLDARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_WorldArrays[a].SetVal (i, ACS_WorldArrays[a].GetVal (i) | STACK(1)); + sp -= 2; + } + break; + + case PCD_ORGLOBALARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_GlobalArrays[a].SetVal (i, ACS_GlobalArrays[a].GetVal (i) | STACK(1)); + sp -= 2; + } + break; + + case PCD_LSSCRIPTVAR: + locals[NEXTBYTE] <<= STACK(1); + sp--; + break; + + case PCD_LSMAPVAR: + *(activeBehavior->MapVars[NEXTBYTE]) <<= STACK(1); + sp--; + break; + + case PCD_LSWORLDVAR: + ACS_WorldVars[NEXTBYTE] <<= STACK(1); + sp--; + break; + + case PCD_LSGLOBALVAR: + ACS_GlobalVars[NEXTBYTE] <<= STACK(1); + sp--; + break; + + case PCD_LSMAPARRAY: + { + int a = *(activeBehavior->MapVars[NEXTBYTE]); + int i = STACK(2); + activeBehavior->SetArrayVal (a, i, activeBehavior->GetArrayVal (a, i) << STACK(1)); + sp -= 2; + } + break; + + case PCD_LSWORLDARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_WorldArrays[a].SetVal (i, ACS_WorldArrays[a].GetVal (i) << STACK(1)); + sp -= 2; + } + break; + + case PCD_LSGLOBALARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_GlobalArrays[a].SetVal (i, ACS_GlobalArrays[a].GetVal (i) << STACK(1)); + sp -= 2; + } + break; + + case PCD_RSSCRIPTVAR: + locals[NEXTBYTE] >>= STACK(1); + sp--; + break; + + case PCD_RSMAPVAR: + *(activeBehavior->MapVars[NEXTBYTE]) >>= STACK(1); + sp--; + break; + + case PCD_RSWORLDVAR: + ACS_WorldVars[NEXTBYTE] >>= STACK(1); + sp--; + break; + + case PCD_RSGLOBALVAR: + ACS_GlobalVars[NEXTBYTE] >>= STACK(1); + sp--; + break; + + case PCD_RSMAPARRAY: + { + int a = *(activeBehavior->MapVars[NEXTBYTE]); + int i = STACK(2); + activeBehavior->SetArrayVal (a, i, activeBehavior->GetArrayVal (a, i) >> STACK(1)); + sp -= 2; + } + break; + + case PCD_RSWORLDARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_WorldArrays[a].SetVal (i, ACS_WorldArrays[a].GetVal (i) >> STACK(1)); + sp -= 2; + } + break; + + case PCD_RSGLOBALARRAY: + { + int a = NEXTBYTE; + int i = STACK(2); + ACS_GlobalArrays[a].SetVal (i, ACS_GlobalArrays[a].GetVal (i) >> STACK(1)); + sp -= 2; + } + break; + //[MW] end + case PCD_INCSCRIPTVAR: ++locals[NEXTBYTE]; break; @@ -4615,6 +4852,7 @@ int DLevelScript::RunScript () STACK(1) = players[STACK(1)].CurrentPlayerClass; } break; + } } diff --git a/src/p_acs.h b/src/p_acs.h index a27d25319..7b21067ae 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -483,7 +483,7 @@ public: PCD_GRABINPUT, // Unused but acc defines them PCD_SETMOUSEPOINTER, // " PCD_MOVEMOUSEPOINTER, // " - PCD_SPAWNPROJECTILE, +/*280*/ PCD_SPAWNPROJECTILE, PCD_GETSECTORLIGHTLEVEL, PCD_GETACTORCEILINGZ, PCD_SETACTORPOSITION, @@ -493,7 +493,44 @@ public: PCD_CHECKACTORINVENTORY, PCD_THINGCOUNTNAME, PCD_SPAWNSPOTFACING, - PCD_PLAYERCLASS, // [GRB] +/*290*/ PCD_PLAYERCLASS, // [GRB] + //[MW] start my p-codes + PCD_ANDSCRIPTVAR, + PCD_ANDMAPVAR, + PCD_ANDWORLDVAR, + PCD_ANDGLOBALVAR, + PCD_ANDMAPARRAY, + PCD_ANDWORLDARRAY, + PCD_ANDGLOBALARRAY, + PCD_EORSCRIPTVAR, + PCD_EORMAPVAR, +/*300*/ PCD_EORWORLDVAR, + PCD_EORGLOBALVAR, + PCD_EORMAPARRAY, + PCD_EORWORLDARRAY, + PCD_EORGLOBALARRAY, + PCD_ORSCRIPTVAR, + PCD_ORMAPVAR, + PCD_ORWORLDVAR, + PCD_ORGLOBALVAR, + PCD_ORMAPARRAY, +/*310*/ PCD_ORWORLDARRAY, + PCD_ORGLOBALARRAY, + PCD_LSSCRIPTVAR, + PCD_LSMAPVAR, + PCD_LSWORLDVAR, + PCD_LSGLOBALVAR, + PCD_LSMAPARRAY, + PCD_LSWORLDARRAY, + PCD_LSGLOBALARRAY, + PCD_RSSCRIPTVAR, +/*320*/ PCD_RSMAPVAR, + PCD_RSWORLDVAR, + PCD_RSGLOBALVAR, + PCD_RSMAPARRAY, + PCD_RSWORLDARRAY, + PCD_RSGLOBALARRAY, + //[MW] end my p-codes PCODE_COMMAND_COUNT };