mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
CON: Add getarraysequence and setarraysequence
Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@8623 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/duke3d/src/game.h
This commit is contained in:
parent
8adb6be002
commit
a2f507d044
4 changed files with 67 additions and 0 deletions
|
@ -136,6 +136,7 @@ static inline int32_t G_GetLogoFlags(void)
|
|||
|
||||
#define MAX_RETURN_VALUES 6
|
||||
|
||||
#define MAX_ARRAYRANGE_VALUES 32
|
||||
typedef struct {
|
||||
vec3_t camerapos;
|
||||
int32_t const_visibility,uw_framerate;
|
||||
|
|
|
@ -267,6 +267,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "getactorvar", CON_GETACTORVAR },
|
||||
{ "getangle", CON_GETANGLE },
|
||||
{ "getangletotarget", CON_GETANGLETOTARGET },
|
||||
{ "getarraysequence", CON_GETARRAYSEQUENCE },
|
||||
{ "getarraysize", CON_GETARRAYSIZE },
|
||||
{ "getceilzofslope", CON_GETCEILZOFSLOPE },
|
||||
{ "getclosestcol", CON_GETCLOSESTCOL },
|
||||
|
@ -480,6 +481,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "setactorsoundpitch", CON_SETACTORSOUNDPITCH },
|
||||
{ "setactorvar", CON_SETACTORVAR },
|
||||
{ "setarray", CON_SETARRAY },
|
||||
{ "setarraysequence", CON_SETARRAYSEQUENCE },
|
||||
{ "setaspect", CON_SETASPECT },
|
||||
{ "setcfgname", CON_SETCFGNAME },
|
||||
{ "setdefname", CON_SETDEFNAME },
|
||||
|
@ -621,6 +623,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "getw", CON_GETWALL },
|
||||
{ "getu", CON_GETUSERDEF },
|
||||
{ "geti", CON_GETINPUT },
|
||||
{ "getarrayseq", CON_GETARRAYSEQUENCE },
|
||||
|
||||
{ "setp", CON_SETPLAYER },
|
||||
{ "setpv", CON_SETPLAYERVAR },
|
||||
|
@ -630,6 +633,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "setw", CON_SETWALL },
|
||||
{ "setu", CON_SETUSERDEF },
|
||||
{ "seti", CON_SETINPUT },
|
||||
{ "setarrayseq", CON_SETARRAYSEQUENCE },
|
||||
|
||||
{ "string", CON_DEFINEQUOTE },
|
||||
{ "print", CON_QUOTE },
|
||||
|
@ -3771,6 +3775,28 @@ setvarvar:
|
|||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
continue;
|
||||
|
||||
case CON_GETARRAYSEQUENCE:
|
||||
case CON_SETARRAYSEQUENCE:
|
||||
{
|
||||
i = C_GetNextGameArrayName();
|
||||
if (EDUKE32_PREDICT_FALSE(i < 0))
|
||||
return 1;
|
||||
C_SkipComments();
|
||||
|
||||
auto pSize = g_scriptPtr++;
|
||||
|
||||
for (j = 0; j < MAX_ARRAYRANGE_VALUES; ++j)
|
||||
{
|
||||
if (C_GetKeyword() != -1)
|
||||
break;
|
||||
|
||||
C_GetNextVarType(tw == CON_GETARRAYSEQUENCE ? GAMEVAR_READONLY : 0);
|
||||
}
|
||||
|
||||
scriptWriteAtOffset(j, pSize);
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_RESIZEARRAY:
|
||||
i = C_GetNextGameArrayName();
|
||||
if (EDUKE32_PREDICT_FALSE(i < 0))
|
||||
|
|
|
@ -1012,6 +1012,7 @@ enum IterationTypes_t
|
|||
TRANSFORM(CON_SETACTORSTRUCT) DELIMITER \
|
||||
TRANSFORM(CON_SETACTORVAR) DELIMITER \
|
||||
TRANSFORM(CON_SETARRAY) DELIMITER \
|
||||
TRANSFORM(CON_SETARRAYSEQUENCE) DELIMITER \
|
||||
TRANSFORM(CON_SETPLAYER) DELIMITER \
|
||||
TRANSFORM(CON_SETPLAYERVAR) DELIMITER \
|
||||
TRANSFORM(CON_SETPROJECTILE) DELIMITER \
|
||||
|
@ -1109,6 +1110,7 @@ enum IterationTypes_t
|
|||
TRANSFORM(CON_GAMETEXTZ) DELIMITER \
|
||||
TRANSFORM(CON_GETACTORANGLE) DELIMITER \
|
||||
TRANSFORM(CON_GETANGLETOTARGET) DELIMITER \
|
||||
TRANSFORM(CON_GETARRAYSEQUENCE) DELIMITER \
|
||||
TRANSFORM(CON_GETARRAYSIZE) DELIMITER \
|
||||
TRANSFORM(CON_GETCEILZOFSLOPE) DELIMITER \
|
||||
TRANSFORM(CON_GETCLOSESTCOL) DELIMITER \
|
||||
|
|
|
@ -5586,6 +5586,44 @@ badindex:
|
|||
dispatch();
|
||||
}
|
||||
|
||||
vInstruction(CON_GETARRAYSEQUENCE):
|
||||
{
|
||||
insptr++;
|
||||
int32_t const arrayNum = *insptr++;
|
||||
int32_t const arraySize = (aGameArrays[arrayNum].flags & GAMEARRAY_VARSIZE) ? Gv_GetVar(aGameArrays[arrayNum].size) : aGameArrays[arrayNum].size;
|
||||
int32_t const sequenceSize = *insptr++;
|
||||
int32_t const copySize = min(sequenceSize, arraySize); // warning?
|
||||
auto const insptrbak = insptr;
|
||||
|
||||
for (int arrayIndex = 0; arrayIndex < copySize; ++arrayIndex)
|
||||
{
|
||||
int32_t const gameVar = *insptr++;
|
||||
int32_t const newValue = Gv_GetArrayValue(arrayNum, arrayIndex);
|
||||
Gv_SetVar(gameVar, newValue);
|
||||
}
|
||||
|
||||
insptr = insptrbak + sequenceSize;
|
||||
dispatch();
|
||||
}
|
||||
|
||||
vInstruction(CON_SETARRAYSEQUENCE):
|
||||
{
|
||||
insptr++;
|
||||
int32_t const arrayNum = *insptr++;
|
||||
int32_t const sequenceSize = *insptr++;
|
||||
|
||||
ResizeArray(arrayNum, sequenceSize);
|
||||
|
||||
for (int arrayIndex = 0; arrayIndex < sequenceSize; ++arrayIndex)
|
||||
{
|
||||
int32_t const gameVar = *insptr++;
|
||||
int32_t const newValue = Gv_GetVar(gameVar);
|
||||
SetArray(arrayNum, arrayIndex, newValue);
|
||||
}
|
||||
|
||||
dispatch();
|
||||
}
|
||||
|
||||
vInstruction(CON_READARRAYFROMFILE):
|
||||
insptr++;
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue