mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
CON: add projectile member .userdata and predefined label PROJ_USERDATA.
It is a 32-bit signed integer. No version bump necessary, although CON code accessing this new member will not work with earlier revisions (obviously). git-svn-id: https://svn.eduke32.com/eduke32@3866 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0d951f0256
commit
2003954492
7 changed files with 42 additions and 2 deletions
|
@ -103,7 +103,8 @@ typedef struct {
|
|||
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
||||
int8_t movecnt; // 1b
|
||||
uint8_t clipdist; // 1b
|
||||
int8_t filler[6]; // 6b
|
||||
int8_t filler[2]; // 2b
|
||||
int32_t userdata; // 4b
|
||||
} projectile_t;
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
|
|
@ -1040,6 +1040,7 @@ const memberlabel_t ProjectileLabels[]=
|
|||
{ "bsound", PROJ_BSOUND, 0, 0 },
|
||||
{ "range", PROJ_RANGE, 0, 0 },
|
||||
{ "flashcolor", PROJ_FLASH_COLOR, 0, 0 },
|
||||
{ "userdata", PROJ_USERDATA, 0, 0 },
|
||||
{ "", -1, 0, 0 } // END OF LIST
|
||||
};
|
||||
|
||||
|
@ -2328,6 +2329,8 @@ LUNATIC_EXTERN void C_DefineProjectile(int32_t j, int32_t what, int32_t val)
|
|||
g_tile[j].defproj.bsound = ProjectileData[j].bsound = val; break;
|
||||
case PROJ_RANGE:
|
||||
g_tile[j].defproj.range = ProjectileData[j].range = val; break;
|
||||
case PROJ_USERDATA:
|
||||
g_tile[j].defproj.userdata = ProjectileData[j].userdata = val; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -6179,6 +6182,7 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("PROJ_TRAIL",PROJ_TRAIL,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_TXREPEAT",PROJ_TXREPEAT,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_TYREPEAT",PROJ_TYREPEAT,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_USERDATA",PROJ_USERDATA,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_VEL_MULT",PROJ_MOVECNT,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_VEL",PROJ_VEL,LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_WORKSLIKE",PROJ_WORKSLIKE,LABEL_DEFINE);
|
||||
|
|
|
@ -566,6 +566,7 @@ enum ProjectileLabel_t
|
|||
PROJ_BSOUND,
|
||||
PROJ_RANGE,
|
||||
PROJ_FLASH_COLOR,
|
||||
PROJ_USERDATA,
|
||||
PROJ_END
|
||||
};
|
||||
#if !defined LUNATIC
|
||||
|
|
|
@ -1205,6 +1205,15 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in
|
|||
Gv_SetVarX(lVar2, SpriteProjectile[proj].flashcolor);
|
||||
return;
|
||||
|
||||
case PROJ_USERDATA:
|
||||
if (iSet)
|
||||
{
|
||||
SpriteProjectile[proj].userdata=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVarX(lVar2, SpriteProjectile[proj].userdata);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -3464,6 +3473,15 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t
|
|||
Gv_SetVarX(lVar2, ProjectileData[lVar1].range);
|
||||
return;
|
||||
|
||||
case PROJ_USERDATA:
|
||||
if (iSet)
|
||||
{
|
||||
ProjectileData[lVar1].userdata=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVarX(lVar2, ProjectileData[lVar1].userdata);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ PROJ = {
|
|||
PROJ_BSOUND = 26,
|
||||
PROJ_RANGE = 27,
|
||||
PROJ_FLASH_COLOR = 28,
|
||||
PROJ_USERDATA = 29,
|
||||
}
|
||||
|
||||
-- PROJ_* define -> projectile_t member name
|
||||
|
@ -798,6 +799,7 @@ local ProjectileLabels = {
|
|||
pal = PROJ".pal",
|
||||
velmult = PROJ".movecnt", -- NAME
|
||||
clipdist = PROJ".clipdist",
|
||||
userdata = PROJ".userdata",
|
||||
}
|
||||
|
||||
-- XXX: kind of CODEDUP form above
|
||||
|
|
|
@ -314,7 +314,8 @@ struct {
|
|||
int8_t shade, xrepeat, yrepeat, pal;
|
||||
int8_t movecnt;
|
||||
uint8_t clipdist;
|
||||
int8_t filler[6];
|
||||
int8_t filler[2];
|
||||
int32_t userdata;
|
||||
}
|
||||
]]
|
||||
|
||||
|
|
|
@ -20,20 +20,33 @@ defineprojectile MORTER2 PROJ_OFFSET 128
|
|||
defineprojectile MORTER2 PROJ_CLIPDIST 24
|
||||
defineprojectile MORTER2 PROJ_TRAIL -1 // overridden in test.elua
|
||||
defineprojectile MORTER2 PROJ_TNUM 6
|
||||
defineprojectile MORTER2 PROJ_USERDATA 32 // test setting initial value
|
||||
|
||||
onevent EVENT_GAME
|
||||
setvarvar WEAPON1_FIRESOUND snd
|
||||
// setvarvar WEAPON1_SHOOTS shoots
|
||||
endevent
|
||||
|
||||
definequote 400 Failed setting projectile userdata
|
||||
|
||||
useractor notenemy 909 // tree trunk
|
||||
ifcount 120
|
||||
{
|
||||
// userdata: bitwise-OR in 64
|
||||
getprojectile[MORTER2].userdata tmp
|
||||
orvar tmp 64
|
||||
setprojectile[MORTER2].userdata tmp
|
||||
|
||||
ezshoot -4096 MORTER2
|
||||
getthisprojectile[RETURN].vel tmp
|
||||
randvar tmp2 500
|
||||
subvarvar tmp tmp2
|
||||
setthisprojectile[RETURN].vel tmp
|
||||
resetcount
|
||||
|
||||
// userdata: must be 32+64 now
|
||||
getthisprojectile[RETURN].userdata tmp
|
||||
ifvarn tmp 96
|
||||
quote 400
|
||||
}
|
||||
enda
|
||||
|
|
Loading…
Reference in a new issue