mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
- Changed A_SetUserVar and A_SetUserArray so they affect the actor that called it, which
is not necessarily "self". The only visible change from this should be that inventory items now set their own variables and not their owners'. SVN r2235 (trunk)
This commit is contained in:
parent
a2cfbec3cf
commit
41df8242c1
1 changed files with 7 additions and 7 deletions
|
@ -3009,7 +3009,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar)
|
|||
ACTION_PARAM_NAME(varname, 0);
|
||||
ACTION_PARAM_INT(value, 1);
|
||||
|
||||
PSymbol *sym = self->GetClass()->Symbols.FindSymbol(varname, true);
|
||||
PSymbol *sym = stateowner->GetClass()->Symbols.FindSymbol(varname, true);
|
||||
PSymbolVariable *var;
|
||||
|
||||
if (sym == NULL || sym->SymbolType != SYM_Variable ||
|
||||
|
@ -3017,11 +3017,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar)
|
|||
var->ValueType.Type != VAL_Int)
|
||||
{
|
||||
Printf("%s is not a user variable in class %s\n", varname.GetChars(),
|
||||
self->GetClass()->TypeName.GetChars());
|
||||
stateowner->GetClass()->TypeName.GetChars());
|
||||
return;
|
||||
}
|
||||
// Set the value of the specified user variable.
|
||||
*(int *)(reinterpret_cast<BYTE *>(self) + var->offset) = value;
|
||||
*(int *)(reinterpret_cast<BYTE *>(stateowner) + var->offset) = value;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -3037,7 +3037,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray)
|
|||
ACTION_PARAM_INT(pos, 1);
|
||||
ACTION_PARAM_INT(value, 2);
|
||||
|
||||
PSymbol *sym = self->GetClass()->Symbols.FindSymbol(varname, true);
|
||||
PSymbol *sym = stateowner->GetClass()->Symbols.FindSymbol(varname, true);
|
||||
PSymbolVariable *var;
|
||||
|
||||
if (sym == NULL || sym->SymbolType != SYM_Variable ||
|
||||
|
@ -3045,17 +3045,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray)
|
|||
var->ValueType.Type != VAL_Array || var->ValueType.BaseType != VAL_Int)
|
||||
{
|
||||
Printf("%s is not a user array in class %s\n", varname.GetChars(),
|
||||
self->GetClass()->TypeName.GetChars());
|
||||
stateowner->GetClass()->TypeName.GetChars());
|
||||
return;
|
||||
}
|
||||
if (pos < 0 || pos >= var->ValueType.size)
|
||||
{
|
||||
Printf("%d is out of bounds in array %s in class %s\n", pos, varname.GetChars(),
|
||||
self->GetClass()->TypeName.GetChars());
|
||||
stateowner->GetClass()->TypeName.GetChars());
|
||||
return;
|
||||
}
|
||||
// Set the value of the specified user array at index pos.
|
||||
((int *)(reinterpret_cast<BYTE *>(self) + var->offset))[pos] = value;
|
||||
((int *)(reinterpret_cast<BYTE *>(stateowner) + var->offset))[pos] = value;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue