mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
CON: Add gettiledata/settiledata. Same members as tiledata[] quick access struct. Not all fields writable.
Patch from Striker. git-svn-id: https://svn.eduke32.com/eduke32@6766 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
548d335316
commit
ed38f0a75d
4 changed files with 63 additions and 0 deletions
|
@ -236,6 +236,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "gettexturefloor", CON_GETTEXTUREFLOOR },
|
||||
{ "getthisprojectile", CON_GETTHISPROJECTILE },
|
||||
{ "getticks", CON_GETTICKS },
|
||||
{ "gettiledata", CON_GETTILEDATA }, // OldMP compat.
|
||||
{ "gettimedate", CON_GETTIMEDATE },
|
||||
{ "gettspr", CON_GETTSPR },
|
||||
{ "getuserdef", CON_GETUSERDEF },
|
||||
|
@ -441,6 +442,7 @@ static tokenmap_t const vm_keywords[] =
|
|||
{ "setsector", CON_SETSECTOR },
|
||||
{ "setsprite", CON_SETSPRITE },
|
||||
{ "setthisprojectile", CON_SETTHISPROJECTILE },
|
||||
{ "settiledata", CON_SETTILEDATA },
|
||||
{ "settspr", CON_SETTSPR },
|
||||
{ "setuserdef", CON_SETUSERDEF },
|
||||
{ "setvar", CON_SETVAR },
|
||||
|
@ -3952,6 +3954,21 @@ DO_DEFSTATE:
|
|||
continue;
|
||||
}
|
||||
|
||||
case CON_SETTILEDATA:
|
||||
case CON_GETTILEDATA:
|
||||
{
|
||||
int32_t const labelNum = C_GetStructureIndexes(0, &h_tiledata);
|
||||
|
||||
if (labelNum == -1)
|
||||
continue;
|
||||
|
||||
BITPTR_CLEAR(g_scriptPtr - apScript);
|
||||
*g_scriptPtr++ = TileDataLabels[labelNum].lId;
|
||||
|
||||
C_GetNextVarType((tw == CON_GETTILEDATA) ? GAMEVAR_READONLY : 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_SETUSERDEF:
|
||||
case CON_GETUSERDEF:
|
||||
{
|
||||
|
|
|
@ -1245,6 +1245,8 @@ enum ScriptKeywords_t
|
|||
CON_UNDEFINECHEAT, // 424
|
||||
CON_SHOWVIEWQ16, // 425
|
||||
CON_SHOWVIEWQ16UNBIASED,// 426
|
||||
CON_GETTILEDATA, // 427
|
||||
CON_SETTILEDATA, // 428
|
||||
CON_END
|
||||
};
|
||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||
|
|
|
@ -4244,6 +4244,26 @@ finish_qsprintf:
|
|||
continue;
|
||||
}
|
||||
|
||||
case CON_GETTILEDATA:
|
||||
insptr++;
|
||||
{
|
||||
int const tileNum = (*insptr++ != g_thisActorVarID) ? Gv_GetVarX(*(insptr - 1)) : vm.pSprite->picnum;
|
||||
int const labelNum = *insptr++;
|
||||
|
||||
Gv_SetVarX(*insptr++, VM_GetTileData(tileNum, labelNum));
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_SETTILEDATA:
|
||||
insptr++;
|
||||
{
|
||||
int const tileNum = (*insptr++ != g_thisActorVarID) ? Gv_GetVarX(*(insptr - 1)) : vm.pSprite->picnum;
|
||||
int const labelNum = *insptr++;
|
||||
|
||||
VM_SetTileData(tileNum, labelNum, Gv_GetVarX(*insptr++));
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_SETUSERDEF:
|
||||
insptr++;
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ void __fastcall VM_SetTsprite(int32_t const spriteNum, int32_t const labelNum, i
|
|||
int32_t __fastcall VM_GetProjectile(int32_t const tileNum, int32_t labelNum);
|
||||
void __fastcall VM_SetProjectile(int32_t const tileNum, int32_t const labelNum, int32_t const iSet);
|
||||
int32_t __fastcall VM_GetTileData(int32_t const tileNum, int32_t labelNum);
|
||||
void __fastcall VM_SetTileData(int32_t const tileNum, int32_t labelNum, int32_t const iSet);
|
||||
int32_t __fastcall VM_GetPalData(int32_t const palNum, int32_t labelNum);
|
||||
#else
|
||||
int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
|
||||
|
@ -1517,6 +1518,29 @@ int32_t __fastcall VM_GetTileData(int32_t const tileNum, int32_t labelNum)
|
|||
return labelNum;
|
||||
}
|
||||
|
||||
void __fastcall VM_SetTileData(int32_t const tileNum, int32_t labelNum, int32_t iSet)
|
||||
{
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)tileNum >= MAXTILES))
|
||||
{
|
||||
CON_ERRPRINTF("invalid tile %d\n", tileNum);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (labelNum)
|
||||
{
|
||||
//case TILEDATA_XSIZE: tilesiz[tileNum].x = iSet; break;
|
||||
//case TILEDATA_YSIZE: tilesiz[tileNum].y = iSet; break;
|
||||
|
||||
case TILEDATA_ANIMFRAMES: picanm[tileNum].num = iSet; break;
|
||||
case TILEDATA_XOFFSET: picanm[tileNum].xofs = iSet; break;
|
||||
case TILEDATA_YOFFSET: picanm[tileNum].yofs = iSet; break;
|
||||
case TILEDATA_ANIMSPEED: picanm[tileNum].sf = (picanm[tileNum].sf & ~PICANM_ANIMSPEED_MASK) | (iSet & PICANM_ANIMSPEED_MASK); break;
|
||||
case TILEDATA_ANIMTYPE: picanm[tileNum].sf = (picanm[tileNum].sf & ~PICANM_ANIMTYPE_MASK) | ((iSet << PICANM_ANIMTYPE_SHIFT) & PICANM_ANIMTYPE_MASK); break;
|
||||
|
||||
case TILEDATA_GAMEFLAGS: g_tile[tileNum].flags = iSet; break;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t __fastcall VM_GetPalData(int32_t const palNum, int32_t labelNum)
|
||||
{
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)palNum >= MAXPALOOKUPS))
|
||||
|
|
Loading…
Reference in a new issue