This commit is contained in:
Christoph Oelckers 2014-07-31 00:44:59 +02:00
commit 09ae52e26b
23 changed files with 489 additions and 160 deletions

View File

@ -340,6 +340,7 @@ enum
MF7_NOTELESTOMP = 0x00000002, // cannot telefrag under any circumstances (even when set by MAPINFO)
MF7_ALWAYSTELEFRAG = 0x00000004, // will unconditionally be telefragged when in the way. Overrides all other settings.
MF7_HANDLENODELAY = 0x00000008, // respect NoDelay state flag
MF7_WEAPONSPAWN = 0x00000010, // subject to DF_NO_COOP_WEAPON_SPAWN dmflag
// --- mobj.renderflags ---
@ -905,6 +906,7 @@ public:
fixed_t wallbouncefactor; // The bounce factor for walls can be different.
int bouncecount; // Strife's grenades only bounce twice before exploding
fixed_t gravity; // [GRB] Gravity factor
fixed_t Friction;
int FastChaseStrafeCount;
fixed_t pushfactor;
int lastpush;

View File

@ -1276,7 +1276,7 @@ void NetUpdate (void)
// listen for other packets
GetPackets ();
if (!demoplayback)
if (!resendOnly)
{
// ideally nettics[0] should be 1 - 3 tics above lowtic
// if we are consistantly slower, speed up time
@ -1323,7 +1323,7 @@ void NetUpdate (void)
}
oldnettics = nettics[0];
}
}// !demoplayback
}
}

View File

@ -154,7 +154,7 @@ static const char * const ActorNames_init[]=
"RocketAmmo",
"RocketBox",
"Cell",
"CellBox",
"CellPack",
"Shell",
"ShellBox",
"Backpack",

View File

@ -122,10 +122,11 @@ FRandom pr_acs ("ACS");
struct CallReturn
{
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, bool discard, unsigned int runaway)
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway)
: ReturnFunction(func),
ReturnModule(module),
ReturnLocals(locals),
ReturnArrays(arrays),
ReturnAddress(pc),
bDiscardResult(discard),
EntryInstrCount(runaway)
@ -134,6 +135,7 @@ struct CallReturn
ScriptFunction *ReturnFunction;
FBehavior *ReturnModule;
SDWORD *ReturnLocals;
ACSLocalArrays *ReturnArrays;
int ReturnAddress;
int bDiscardResult;
unsigned int EntryInstrCount;
@ -1673,6 +1675,26 @@ void FBehavior::SerializeVarSet (FArchive &arc, SDWORD *vars, int max)
}
}
static int ParseLocalArrayChunk(void *chunk, ACSLocalArrays *arrays, int offset)
{
unsigned count = (LittleShort(((unsigned *)chunk)[1]) - 2) / 4;
int *sizes = (int *)((BYTE *)chunk + 10);
arrays->Count = count;
if (count > 0)
{
ACSLocalArrayInfo *info = new ACSLocalArrayInfo[count];
arrays->Info = info;
for (unsigned i = 0; i < count; ++i)
{
info[i].Size = LittleLong(sizes[i]);
info[i].Offset = offset;
offset += info[i].Size;
}
}
// Return the new local variable size, with space for the arrays
return offset;
}
FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
{
BYTE *object;
@ -1822,12 +1844,45 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
{
DWORD *chunk;
Functions = FindChunk (MAKE_ID('F','U','N','C'));
if (Functions != NULL)
// Load functions
BYTE *funcs;
Functions = NULL;
funcs = FindChunk (MAKE_ID('F','U','N','C'));
if (funcs != NULL)
{
NumFunctions = LittleLong(((DWORD *)Functions)[1]) / 8;
Functions += 8;
NumFunctions = LittleLong(((DWORD *)funcs)[1]) / 8;
funcs += 8;
FunctionProfileData = new ACSProfileInfo[NumFunctions];
Functions = new ScriptFunction[NumFunctions];
for (i = 0; i < NumFunctions; ++i)
{
ScriptFunctionInFile *funcf = &((ScriptFunctionInFile *)funcs)[i];
ScriptFunction *funcm = &Functions[i];
funcm->ArgCount = funcf->ArgCount;
funcm->HasReturnValue = funcf->HasReturnValue;
funcm->ImportNum = funcf->ImportNum;
funcm->LocalCount = funcf->LocalCount;
funcm->Address = funcf->Address;
}
}
// Load local arrays for functions
if (NumFunctions > 0)
{
for (chunk = (DWORD *)FindChunk(MAKE_ID('F','A','R','Y')); chunk != NULL; chunk = (DWORD *)NextChunk((BYTE *)chunk))
{
int size = LittleLong(chunk[1]);
if (size >= 6)
{
unsigned int func_num = LittleShort(((WORD *)chunk)[4]);
if (func_num < (unsigned int)NumFunctions)
{
ScriptFunction *func = &Functions[func_num];
// Unlike scripts, functions do not include their arg count in their local count.
func->LocalCount = ParseLocalArrayChunk(chunk, &func->LocalArrays, func->LocalCount + func->ArgCount) - func->ArgCount;
}
}
}
}
// Load JUMP points
@ -2135,6 +2190,11 @@ FBehavior::~FBehavior ()
delete[] ArrayStore;
ArrayStore = NULL;
}
if (Functions != NULL)
{
delete[] Functions;
Functions = NULL;
}
if (FunctionProfileData != NULL)
{
delete[] FunctionProfileData;
@ -2302,6 +2362,21 @@ void FBehavior::LoadScriptsDirectory ()
}
}
// Load script array sizes. (One chunk per script that uses arrays.)
for (scripts.b = FindChunk(MAKE_ID('S','A','R','Y')); scripts.dw != NULL; scripts.b = NextChunk(scripts.b))
{
int size = LittleLong(scripts.dw[1]);
if (size >= 6)
{
int script_num = LittleShort(scripts.w[4]);
ScriptPtr *ptr = const_cast<ScriptPtr *>(FindScript(script_num));
if (ptr != NULL)
{
ptr->VarCount = ParseLocalArrayChunk(scripts.b, &ptr->LocalArrays, ptr->VarCount);
}
}
}
// Load script names (if any)
scripts.b = FindChunk(MAKE_ID('S','N','A','M'));
if (scripts.dw != NULL)
@ -3530,7 +3605,8 @@ enum
APROP_MeleeRange = 38,
APROP_ViewHeight = 39,
APROP_AttackZOffset = 40,
APROP_StencilColor = 41
APROP_StencilColor = 41,
APROP_Friction = 42,
};
// These are needed for ACS's APROP_RenderStyle
@ -3764,6 +3840,9 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
actor->SetShade(value);
break;
case APROP_Friction:
actor->Friction = value;
default:
// do nothing.
break;
@ -3862,6 +3941,7 @@ int DLevelScript::GetActorProperty (int tid, int property, const SDWORD *stack,
case APROP_Species: return GlobalACSStrings.AddString(actor->GetSpecies(), stack, stackdepth);
case APROP_NameTag: return GlobalACSStrings.AddString(actor->GetTag(), stack, stackdepth);
case APROP_StencilColor:return actor->fillcolor;
case APROP_Friction: return actor->Friction;
default: return 0;
}
@ -5460,14 +5540,50 @@ inline int getshort (int *&pc)
return res;
}
static bool CharArrayParms(int &capacity, int &offset, int &a, int *Stack, int &sp, bool ranged)
{
if (ranged)
{
capacity = STACK(1);
offset = STACK(2);
if (capacity < 1 || offset < 0)
{
sp -= 4;
return false;
}
sp -= 2;
}
else
{
capacity = INT_MAX;
offset = 0;
}
a = STACK(1);
offset += STACK(2);
sp -= 2;
return true;
}
int DLevelScript::RunScript ()
{
DACSThinker *controller = DACSThinker::ActiveThinker;
SDWORD *locals = localvars;
ACSLocalArrays noarrays;
ACSLocalArrays *localarrays = &noarrays;
ScriptFunction *activeFunction = NULL;
FRemapTable *translation = 0;
int resultValue = 1;
if (InModuleScriptNumber >= 0)
{
ScriptPtr *ptr = activeBehavior->GetScriptPtr(InModuleScriptNumber);
assert(ptr != NULL);
if (ptr != NULL)
{
localarrays = &ptr->LocalArrays;
}
}
// Hexen truncates all special arguments to bytes (only when using an old MAPINFO and old ACS format
const int specialargmask = ((level.flags2 & LEVEL2_HEXENHACK) && activeBehavior->GetFormat() == ACS_Old) ? 255 : ~0;
@ -5832,9 +5948,10 @@ int DLevelScript::RunScript ()
}
sp += i;
::new(&Stack[sp]) CallReturn(activeBehavior->PC2Ofs(pc), activeFunction,
activeBehavior, mylocals, pcd == PCD_CALLDISCARD, runaway);
activeBehavior, mylocals, localarrays, pcd == PCD_CALLDISCARD, runaway);
sp += (sizeof(CallReturn) + sizeof(int) - 1) / sizeof(int);
pc = module->Ofs2PC (func->Address);
localarrays = &func->LocalArrays;
activeFunction = func;
activeBehavior = module;
fmt = module->GetFormat();
@ -5868,6 +5985,7 @@ int DLevelScript::RunScript ()
activeBehavior = ret->ReturnModule;
fmt = activeBehavior->GetFormat();
locals = ret->ReturnLocals;
localarrays = ret->ReturnArrays;
if (!ret->bDiscardResult)
{
Stack[sp++] = value;
@ -5966,6 +6084,11 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_ASSIGNSCRIPTARRAY:
localarrays->Set(locals, NEXTBYTE, STACK(2), STACK(1));
sp -= 2;
break;
case PCD_ASSIGNMAPARRAY:
activeBehavior->SetArrayVal (*(activeBehavior->MapVars[NEXTBYTE]), STACK(2), STACK(1));
sp -= 2;
@ -5997,6 +6120,10 @@ int DLevelScript::RunScript ()
PushToStack (ACS_GlobalVars[NEXTBYTE]);
break;
case PCD_PUSHSCRIPTARRAY:
STACK(1) = localarrays->Get(locals, NEXTBYTE, STACK(1));
break;
case PCD_PUSHMAPARRAY:
STACK(1) = activeBehavior->GetArrayVal (*(activeBehavior->MapVars[NEXTBYTE]), STACK(1));
break;
@ -6029,6 +6156,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_ADDSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) + STACK(1));
sp -= 2;
}
break;
case PCD_ADDMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6074,6 +6209,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_SUBSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) - STACK(1));
sp -= 2;
}
break;
case PCD_SUBMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6119,6 +6262,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_MULSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) * STACK(1));
sp -= 2;
}
break;
case PCD_MULMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6192,6 +6343,19 @@ int DLevelScript::RunScript ()
}
break;
case PCD_DIVSCRIPTARRAY:
if (STACK(1) == 0)
{
state = SCRIPT_DivideBy0;
}
else
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) / STACK(1));
sp -= 2;
}
break;
case PCD_DIVMAPARRAY:
if (STACK(1) == 0)
{
@ -6280,6 +6444,19 @@ int DLevelScript::RunScript ()
}
break;
case PCD_MODSCRIPTARRAY:
if (STACK(1) == 0)
{
state = SCRIPT_ModulusBy0;
}
else
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) % STACK(1));
sp -= 2;
}
break;
case PCD_MODMAPARRAY:
if (STACK(1) == 0)
{
@ -6341,6 +6518,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_ANDSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) & STACK(1));
sp -= 2;
}
break;
case PCD_ANDMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6386,6 +6571,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_EORSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) ^ STACK(1));
sp -= 2;
}
break;
case PCD_EORMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6431,6 +6624,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_ORSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) | STACK(1));
sp -= 2;
}
break;
case PCD_ORMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6477,6 +6678,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_LSSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) << STACK(1));
sp -= 2;
}
break;
case PCD_LSMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6522,6 +6731,14 @@ int DLevelScript::RunScript ()
sp--;
break;
case PCD_RSSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(2);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) >> STACK(1));
sp -= 2;
}
break;
case PCD_RSMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6564,6 +6781,14 @@ int DLevelScript::RunScript ()
++ACS_GlobalVars[NEXTBYTE];
break;
case PCD_INCSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(1);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) + 1);
sp--;
}
break;
case PCD_INCMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -6605,6 +6830,14 @@ int DLevelScript::RunScript ()
--ACS_GlobalVars[NEXTBYTE];
break;
case PCD_DECSCRIPTARRAY:
{
int a = NEXTBYTE, i = STACK(1);
localarrays->Set(locals, a, i, localarrays->Get(locals, a, i) - 1);
sp--;
}
break;
case PCD_DECMAPARRAY:
{
int a = *(activeBehavior->MapVars[NEXTBYTE]);
@ -7031,37 +7264,35 @@ scriptwait:
}
break;
// Print script character array
case PCD_PRINTSCRIPTCHARARRAY:
case PCD_PRINTSCRIPTCHRANGE:
{
int capacity, offset, a, c;
if (CharArrayParms(capacity, offset, a, Stack, sp, pcd == PCD_PRINTSCRIPTCHRANGE))
{
while (capacity-- && (c = localarrays->Get(locals, a, offset)) != '\0')
{
work += (char)c;
offset++;
}
}
}
break;
// [JB] Print map character array
case PCD_PRINTMAPCHARARRAY:
case PCD_PRINTMAPCHRANGE:
{
int capacity, offset;
if (pcd == PCD_PRINTMAPCHRANGE)
int capacity, offset, a, c;
if (CharArrayParms(capacity, offset, a, Stack, sp, pcd == PCD_PRINTMAPCHRANGE))
{
capacity = STACK(1);
offset = STACK(2);
if (capacity < 1 || offset < 0)
while (capacity-- && (c = activeBehavior->GetArrayVal (a, offset)) != '\0')
{
sp -= 4;
break;
work += (char)c;
offset++;
}
sp -= 2;
}
else
{
capacity = 0x7FFFFFFF;
offset = 0;
}
int a = *(activeBehavior->MapVars[STACK(1)]);
offset += STACK(2);
int c;
while(capacity-- && (c = activeBehavior->GetArrayVal (a, offset)) != '\0') {
work += (char)c;
offset++;
}
sp-= 2;
}
break;
@ -7069,32 +7300,15 @@ scriptwait:
case PCD_PRINTWORLDCHARARRAY:
case PCD_PRINTWORLDCHRANGE:
{
int capacity, offset;
if (pcd == PCD_PRINTWORLDCHRANGE)
int capacity, offset, a, c;
if (CharArrayParms(capacity, offset, a, Stack, sp, pcd == PCD_PRINTWORLDCHRANGE))
{
capacity = STACK(1);
offset = STACK(2);
if (capacity < 1 || offset < 0)
while (capacity-- && (c = ACS_WorldArrays[a][offset]) != '\0')
{
sp -= 4;
break;
work += (char)c;
offset++;
}
sp -= 2;
}
else
{
capacity = 0x7FFFFFFF;
offset = 0;
}
int a = STACK(1);
offset += STACK(2);
int c;
while(capacity-- && (c = ACS_WorldArrays[a][offset]) != '\0') {
work += (char)c;
offset++;
}
sp-= 2;
}
break;
@ -7102,32 +7316,15 @@ scriptwait:
case PCD_PRINTGLOBALCHARARRAY:
case PCD_PRINTGLOBALCHRANGE:
{
int capacity, offset;
if (pcd == PCD_PRINTGLOBALCHRANGE)
int capacity, offset, a, c;
if (CharArrayParms(capacity, offset, a, Stack, sp, pcd == PCD_PRINTGLOBALCHRANGE))
{
capacity = STACK(1);
offset = STACK(2);
if (capacity < 1 || offset < 0)
while (capacity-- && (c = ACS_GlobalArrays[a][offset]) != '\0')
{
sp -= 4;
break;
work += (char)c;
offset++;
}
sp -= 2;
}
else
{
capacity = 0x7FFFFFFF;
offset = 0;
}
int a = STACK(1);
offset += STACK(2);
int c;
while(capacity-- && (c = ACS_GlobalArrays[a][offset]) != '\0') {
work += (char)c;
offset++;
}
sp-= 2;
}
break;
@ -8674,6 +8871,7 @@ scriptwait:
}
break;
case PCD_STRCPYTOSCRIPTCHRANGE:
case PCD_STRCPYTOMAPCHRANGE:
case PCD_STRCPYTOWORLDCHRANGE:
case PCD_STRCPYTOGLOBALCHRANGE:
@ -8704,7 +8902,7 @@ scriptwait:
break;
}
for (int i = 0;i < STACK(1); i++)
for (int i = 0; i < STACK(1); i++)
{
if (! (*(lookup++)))
{
@ -8715,43 +8913,55 @@ scriptwait:
switch (pcd)
{
case PCD_STRCPYTOMAPCHRANGE:
{
int a = STACK(5);
if (a < NUM_MAPVARS && a > 0 &&
activeBehavior->MapVars[a])
{
Stack[sp-6] = activeBehavior->CopyStringToArray(*(activeBehavior->MapVars[a]), index, capacity, lookup);
}
}
break;
case PCD_STRCPYTOWORLDCHRANGE:
{
int a = STACK(5);
case PCD_STRCPYTOSCRIPTCHRANGE:
{
int a = STACK(5);
while (capacity-- > 0)
{
ACS_WorldArrays[a][index++] = *lookup;
if (! (*(lookup++))) goto STRCPYTORANGECOMPLETE; // complete with terminating 0
}
Stack[sp-6] = !(*lookup); // true/success if only terminating 0 was not copied
}
break;
case PCD_STRCPYTOGLOBALCHRANGE:
while (capacity-- > 0)
{
int a = STACK(5);
while (capacity-- > 0)
{
ACS_GlobalArrays[a][index++] = *lookup;
if (! (*(lookup++))) goto STRCPYTORANGECOMPLETE; // complete with terminating 0
}
Stack[sp-6] = !(*lookup); // true/success if only terminating 0 was not copied
localarrays->Set(locals, a, index++, *lookup);
if (! (*(lookup++))) goto STRCPYTORANGECOMPLETE; // complete with terminating 0
}
break;
Stack[sp-6] = !(*lookup); // true/success if only terminating 0 was not copied
}
break;
case PCD_STRCPYTOMAPCHRANGE:
{
int a = STACK(5);
if (a < NUM_MAPVARS && a > 0 &&
activeBehavior->MapVars[a])
{
Stack[sp-6] = activeBehavior->CopyStringToArray(*(activeBehavior->MapVars[a]), index, capacity, lookup);
}
}
break;
case PCD_STRCPYTOWORLDCHRANGE:
{
int a = STACK(5);
while (capacity-- > 0)
{
ACS_WorldArrays[a][index++] = *lookup;
if (! (*(lookup++))) goto STRCPYTORANGECOMPLETE; // complete with terminating 0
}
Stack[sp-6] = !(*lookup); // true/success if only terminating 0 was not copied
}
break;
case PCD_STRCPYTOGLOBALCHRANGE:
{
int a = STACK(5);
while (capacity-- > 0)
{
ACS_GlobalArrays[a][index++] = *lookup;
if (! (*(lookup++))) goto STRCPYTORANGECOMPLETE; // complete with terminating 0
}
Stack[sp-6] = !(*lookup); // true/success if only terminating 0 was not copied
}
break;
}
sp -= 5;
}

View File

@ -144,6 +144,51 @@ struct ProfileCollector
int Index;
};
struct ACSLocalArrayInfo
{
unsigned int Size;
int Offset;
};
struct ACSLocalArrays
{
unsigned int Count;
ACSLocalArrayInfo *Info;
ACSLocalArrays()
{
Count = 0;
Info = NULL;
}
~ACSLocalArrays()
{
if (Info != NULL)
{
delete[] Info;
Info = NULL;
}
}
// Bounds-checking Set and Get for local arrays
void Set(int *locals, int arraynum, int arrayentry, int value)
{
if ((unsigned int)arraynum < Count &&
(unsigned int)arrayentry < Info[arraynum].Size)
{
locals[Info[arraynum].Offset + arrayentry] = value;
}
}
int Get(int *locals, int arraynum, int arrayentry)
{
if ((unsigned int)arraynum < Count &&
(unsigned int)arrayentry < Info[arraynum].Size)
{
return locals[Info[arraynum].Offset + arrayentry];
}
return 0;
}
};
// The in-memory version
struct ScriptPtr
{
@ -153,6 +198,7 @@ struct ScriptPtr
BYTE ArgCount;
WORD VarCount;
WORD Flags;
ACSLocalArrays LocalArrays;
ACSProfileInfo ProfileData;
};
@ -189,7 +235,7 @@ struct ScriptFlagsPtr
WORD Flags;
};
struct ScriptFunction
struct ScriptFunctionInFile
{
BYTE ArgCount;
BYTE LocalCount;
@ -198,6 +244,16 @@ struct ScriptFunction
DWORD Address;
};
struct ScriptFunction
{
BYTE ArgCount;
BYTE HasReturnValue;
BYTE ImportNum;
int LocalCount;
DWORD Address;
ACSLocalArrays LocalArrays;
};
// Script types
enum
{
@ -285,7 +341,7 @@ private:
BYTE *Chunks;
ScriptPtr *Scripts;
int NumScripts;
BYTE *Functions;
ScriptFunction *Functions;
ACSProfileInfo *FunctionProfileData;
int NumFunctions;
ArrayInfo *ArrayStore;
@ -694,8 +750,25 @@ public:
PCD_SCRIPTWAITNAMED,
PCD_TRANSLATIONRANGE3,
PCD_GOTOSTACK,
PCD_ASSIGNSCRIPTARRAY,
PCD_PUSHSCRIPTARRAY,
PCD_ADDSCRIPTARRAY,
PCD_SUBSCRIPTARRAY,
PCD_MULSCRIPTARRAY,
PCD_DIVSCRIPTARRAY,
/*370*/ PCD_MODSCRIPTARRAY,
PCD_INCSCRIPTARRAY,
PCD_DECSCRIPTARRAY,
PCD_ANDSCRIPTARRAY,
PCD_EORSCRIPTARRAY,
PCD_ORSCRIPTARRAY,
PCD_LSSCRIPTARRAY,
PCD_RSSCRIPTARRAY,
PCD_PRINTSCRIPTCHARARRAY,
PCD_PRINTSCRIPTCHRANGE,
/*380*/ PCD_STRCPYTOSCRIPTCHRANGE,
/*363*/ PCODE_COMMAND_COUNT
/*381*/ PCODE_COMMAND_COUNT
};
// Some constants used by ACS scripts

View File

@ -16,6 +16,7 @@
#include "p_setup.h"
#include "g_level.h"
#include "r_data/colormaps.h"
#include "gi.h"
// MACROS ------------------------------------------------------------------
@ -361,9 +362,8 @@ static bool P_LoadBloodMap (BYTE *data, size_t len, FMapThing **mapthings, int *
// BUILD info from the map we need. (Sprites are ignored.)
LoadSectors (bsec);
LoadWalls (bwal, numWalls, bsec);
*mapthings = new FMapThing[numsprites + 1];
CreateStartSpot ((fixed_t *)infoBlock, *mapthings);
*numspr = 1 + LoadSprites (bspr, xspr, numsprites, bsec, *mapthings + 1);
*mapthings = new FMapThing[numsprites];
*numspr = LoadSprites (bspr, xspr, numsprites, bsec, *mapthings);
delete[] bsec;
delete[] bwal;
@ -687,6 +687,8 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
{
int count = 0;
memset(mapthings, 0, sizeof(*mapthings)*numsprites);
for (int i = 0; i < numsprites; ++i)
{
mapthings[count].thingid = 0;
@ -699,18 +701,31 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
mapthings[count].flags = MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH;
mapthings[count].special = 0;
mapthings[count].gravity = FRACUNIT;
mapthings[count].RenderStyle = STYLE_Count;
mapthings[count].alpha = -1;
mapthings[count].health = -1;
if (xsprites != NULL && sprites[i].lotag == 710)
{ // Blood ambient sound
mapthings[count].args[0] = xsprites[i].Data3;
// I am totally guessing abount the volume level. 50 seems to be a pretty
// I am totally guessing about the volume level. 50 seems to be a pretty
// typical value for Blood's standard maps, so I assume it's 100-based.
mapthings[count].args[1] = xsprites[i].Data4;
mapthings[count].args[2] = xsprites[i].Data1;
mapthings[count].args[3] = xsprites[i].Data2;
mapthings[count].args[4] = 0;
mapthings[count].type = 14065;
}
else if (xsprites != NULL && sprites[i].lotag == 1)
{ // Blood player start
if (xsprites[i].Data1 < 4)
mapthings[count].type = 1 + xsprites[i].Data1;
else
mapthings[count].type = gameinfo.player5start + xsprites[i].Data1 - 4;
}
else if (xsprites != NULL && sprites[i].lotag == 2)
{ // Bloodbath start
mapthings[count].type = 11;
}
else
{
if (sprites[i].cstat & (16|32|32768)) continue;

View File

@ -1014,7 +1014,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
// Building nodes in debug is much slower so let's cache them only if cachetime is 0
buildtime = 0;
#endif
if (gl_cachenodes && buildtime/1000.f >= gl_cachetime)
if (level.maptype != MAPTYPE_BUILD && gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
CreateCachedNodes(map);

View File

@ -554,7 +554,13 @@ int P_GetFriction (const AActor *mo, int *frictionfactor)
}
}
}
if (mo->Friction != FRACUNIT)
{
friction = clamp(FixedMul(friction, mo->Friction), 0, FRACUNIT);
movefactor = FrictionToMoveFactor(friction);
}
if (frictionfactor)
*frictionfactor = movefactor;

View File

@ -4724,7 +4724,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
// [RH] don't spawn extra weapons in coop if so desired
if (multiplayer && !deathmatch && (dmflags & DF_NO_COOP_WEAPON_SPAWN))
{
if (i->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
if (GetDefaultByType(i)->flags7 & MF7_WEAPONSPAWN)
{
if ((mthing->flags & (MTF_DEATHMATCH|MTF_SINGLE)) == MTF_DEATHMATCH)
return NULL;

View File

@ -312,7 +312,6 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
if (map->Encrypted)
{ // If it's encrypted, then it's a Blood file, presumably a map.
map->MapLumps[0].Reader = map->file = Wads.ReopenLumpNum(lump_name);
if (!P_IsBuildMap(map))
{
delete map;

View File

@ -1990,26 +1990,12 @@ void P_SetSectorFriction (int tag, int amount, bool alterFlag)
friction = (0x1EB8*amount)/0x80 + 0xD001;
// killough 8/28/98: prevent odd situations
if (friction > FRACUNIT)
friction = FRACUNIT;
if (friction < 0)
friction = 0;
friction = clamp(friction, 0, FRACUNIT);
// The following check might seem odd. At the time of movement,
// the move distance is multiplied by 'friction/0x10000', so a
// higher friction value actually means 'less friction'.
// [RH] Twiddled these values so that velocity on ice (with
// friction 0xf900) is the same as in Heretic/Hexen.
if (friction >= ORIG_FRICTION) // ice
// movefactor = ((0x10092 - friction)*(0x70))/0x158;
movefactor = ((0x10092 - friction) * 1024) / 4352 + 568;
else
movefactor = ((friction - 0xDB34)*(0xA))/0x80;
// killough 8/28/98: prevent odd situations
if (movefactor < 32)
movefactor = 32;
movefactor = FrictionToMoveFactor(friction);
for (s = -1; (s = P_FindSectorFromTag (tag,s)) >= 0; )
{

View File

@ -172,6 +172,25 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType);
void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass, int flags);
void P_SetSectorFriction (int tag, int amount, bool alterFlag);
inline fixed_t FrictionToMoveFactor(fixed_t friction)
{
fixed_t movefactor;
// [RH] Twiddled these values so that velocity on ice (with
// friction 0xf900) is the same as in Heretic/Hexen.
if (friction >= ORIG_FRICTION) // ice
// movefactor = ((0x10092 - friction)*(0x70))/0x158;
movefactor = ((0x10092 - friction) * 1024) / 4352 + 568;
else
movefactor = ((friction - 0xDB34)*(0xA))/0x80;
// killough 8/28/98: prevent odd situations
if (movefactor < 32)
movefactor = 32;
return movefactor;
}
void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornum);
//

View File

@ -925,8 +925,6 @@ void R_InitSprites ()
numskins++;
}
SpriteFrames.Clear();
// [RH] Do some preliminary setup
if (skins != NULL) delete [] skins;
skins = new FPlayerSkin[numskins];

View File

@ -289,8 +289,8 @@ bool F7ZFile::Open(bool quiet)
continue;
}
nameUTF16.Resize(nameLength);
nameASCII.Resize(nameLength);
nameUTF16.Resize((unsigned)nameLength);
nameASCII.Resize((unsigned)nameLength);
SzArEx_GetFileNameUtf16(&Archive->DB, i, &nameUTF16[0]);
for (size_t c = 0; c < nameLength; ++c)
{

View File

@ -511,8 +511,6 @@ int S_AddSoundLump (const char *logicalname, int lump)
newsfx.LimitRange = 256*256;
newsfx.bRandomHeader = false;
newsfx.bPlayerReserve = false;
newsfx.bForce11025 = false;
newsfx.bForce22050 = false;
newsfx.bLoadRAW = false;
newsfx.bPlayerCompat = false;
newsfx.b16bit = false;
@ -520,6 +518,7 @@ int S_AddSoundLump (const char *logicalname, int lump)
newsfx.bSingular = false;
newsfx.bTentative = false;
newsfx.bPlayerSilent = false;
newsfx.RawRate = 0;
newsfx.link = sfxinfo_t::NO_LINK;
newsfx.Rolloff.RolloffType = ROLLOFF_Doom;
newsfx.Rolloff.MinDistance = 0;
@ -1414,13 +1413,17 @@ static void S_AddBloodSFX (int lumpnum)
{
const char *name = Wads.GetLumpFullName(lumpnum);
sfxnum = S_AddSound(name, rawlump);
if (sfx->Format == 5)
{
S_sfx[sfxnum].bForce22050 = true;
if (sfx->Format < 5 || sfx->Format > 12)
{ // [0..4] + invalid formats
S_sfx[sfxnum].RawRate = 11025;
}
else // I don't know any other formats for this
{
S_sfx[sfxnum].bForce11025 = true;
else if (sfx->Format < 9)
{ // [5..8]
S_sfx[sfxnum].RawRate = 22050;
}
else
{ // [9..12]
S_sfx[sfxnum].RawRate = 44100;
}
S_sfx[sfxnum].bLoadRAW = true;
S_sfx[sfxnum].LoopStart = LittleLong(sfx->LoopStart);
@ -1433,7 +1436,7 @@ static void S_AddBloodSFX (int lumpnum)
ambient->periodmax = 0;
ambient->volume = 1;
ambient->attenuation = 1;
ambient->sound = name;
ambient->sound = FSoundID(sfxnum);
}
}
@ -2231,7 +2234,7 @@ void AAmbientSound::BeginPlay ()
//
// AmbientSound :: Activate
//
// Starts playing a sound (or does nothing of the sound is already playing).
// Starts playing a sound (or does nothing if the sound is already playing).
//
//==========================================================================

View File

@ -1334,7 +1334,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
if (sfx->bLoadRAW)
{
len = Wads.LumpLength (sfx->lumpnum);
frequency = (sfx->bForce22050 ? 22050 : 11025);
frequency = sfx->RawRate;
}
else
{

View File

@ -49,8 +49,6 @@ struct sfxinfo_t
WORD bRandomHeader:1;
WORD bPlayerReserve:1;
WORD bForce11025:1;
WORD bForce22050:1;
WORD bLoadRAW:1;
WORD bPlayerCompat:1;
WORD b16bit:1;
@ -59,6 +57,8 @@ struct sfxinfo_t
WORD bTentative:1;
WORD bPlayerSilent:1; // This player sound is intentionally silent.
WORD RawRate; // Sample rate to use when bLoadRAW is true
int LoopStart; // -1 means no specific loop defined
unsigned int link;

View File

@ -964,6 +964,7 @@ void FTextureManager::SortTexturesByType(int start, int end)
void FTextureManager::Init()
{
DeleteAll();
SpriteFrames.Clear();
// Init Build Tile data if it hasn't been done already
if (BuildTileFiles.Size() == 0) CountBuildTiles ();
FTexture::InitGrayMap();

View File

@ -240,6 +240,7 @@ static FFlagDef ActorFlags[]=
DEFINE_FLAG(MF7, NEVERTARGET, AActor, flags7),
DEFINE_FLAG(MF7, NOTELESTOMP, AActor, flags7),
DEFINE_FLAG(MF7, ALWAYSTELEFRAG, AActor, flags7),
DEFINE_FLAG(MF7, WEAPONSPAWN, AActor, flags7),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),

View File

@ -1297,6 +1297,17 @@ DEFINE_PROPERTY(gravity, F, Actor)
defaults->gravity = i;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(friction, F, Actor)
{
PROP_FIXED_PARM(i, 0);
if (i < 0) I_Error ("Friction must not be negative.");
defaults->Friction = i;
}
//==========================================================================
//
//==========================================================================

View File

@ -18,6 +18,7 @@ ACTOR Actor native //: Thinker
FloatSpeed 4
FloatBobPhase -1 // randomly initialize by default
Gravity 1
Friction 1
DamageFactor 1.0
PushFactor 0.25
WeaveIndexXY 0

View File

@ -335,6 +335,7 @@ Actor Weapon : Inventory native
Weapon.BobSpeed 1.0
Weapon.BobRangeX 1.0
Weapon.BobRangeY 1.0
+WEAPONSPAWN
States
{
LightDone:
@ -362,4 +363,7 @@ Actor WeaponHolder : Inventory native
+INVENTORY.UNDROPPABLE
}
Actor WeaponPiece : Inventory native {}
Actor WeaponPiece : Inventory native
{
+WEAPONSPAWN
}

View File

@ -162,8 +162,8 @@ Global
{A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|Win32.Build.0 = Release|Win32
{A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|x64.ActiveCfg = Release|x64
{A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|x64.Build.0 = Release|x64
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.ActiveCfg = Release|Win32
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.Build.0 = Release|Win32
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.ActiveCfg = Debug|Win32
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.Build.0 = Debug|Win32
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|x64.ActiveCfg = Release|x64
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|x64.Build.0 = Release|x64
{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Release|Win32.ActiveCfg = Release|Win32