Further cleanup of A_InsertSprite().

git-svn-id: https://svn.eduke32.com/eduke32@5567 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-01-15 07:58:52 +00:00
parent 28ba642342
commit ba54de3ab3
3 changed files with 12 additions and 39 deletions

View file

@ -5054,40 +5054,12 @@ static actor_t NullActor;
static spriteext_t NullSprExt;
static spritesmooth_t NullSprSmooth;
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,
int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss)
int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int16_t s_pn,int8_t s_s,
uint8_t s_xr,uint8_t s_yr,int16_t s_a,int16_t s_ve,int16_t s_zv,int16_t s_ow,int16_t s_ss)
{
int32_t p;
int32_t i;
spritetype *s;
tspritetype spr_temp;
int32_t i = Net_IsRelevantStat(s_ss) ? Net_InsertSprite(whatsect, s_ss) : insertsprite(whatsect, s_ss);
// NetAlloc
if (Net_IsRelevantStat(s_ss))
{
i = Net_InsertSprite(whatsect,s_ss);
}
else
{
i = insertsprite(whatsect,s_ss);
}
memset(&spr_temp, 0, sizeof(spritetype));
spr_temp.x = s_x;
spr_temp.y = s_y;
spr_temp.z = s_z;
spr_temp.picnum = s_pn;
spr_temp.shade = s_s;
spr_temp.xrepeat = s_xr;
spr_temp.yrepeat = s_yr;
spr_temp.sectnum = whatsect;
spr_temp.statnum = s_ss;
spr_temp.ang = s_a;
spr_temp.owner = s_ow;
spr_temp.xvel = s_ve;
spr_temp.zvel = s_zv;
if (i < 0)
if (EDUKE32_PREDICT_FALSE(i) < 0)
{
G_DumpDebugInfo();
OSD_Printf("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n",
@ -5095,11 +5067,14 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
G_GameExit("Too many sprites spawned.");
}
tspritetype spr_temp = { s_x, s_y, s_z, 0, s_pn, s_s, 0, 0, 0, s_xr, s_yr, 0,
0, whatsect, s_ss, s_a, s_ow, s_ve, 0, s_zv, 0, 0, 0 };
#ifdef DEBUGGINGAIDS
g_spriteStat.numins++;
#endif
s = &sprite[i];
spritetype *s = &sprite[i];
*s = *(spritetype *)&spr_temp;
actor[i] = NullActor;
actor[i].bpos = *(vec3_t *) &s;
@ -5114,8 +5089,6 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
actor[i].actorstayput = actor[i].extra = actor[i].lightId = -1;
actor[i].owner = s_ow;
// sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
G_InitActor(i, s_pn, 1);
spriteext[i] = NullSprExt;
@ -5131,7 +5104,7 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
if (VM_HaveEvent(EVENT_EGS))
{
int32_t pl=A_FindPlayer(s, &p);
int32_t p, pl = A_FindPlayer(s, &p);
block_deletesprite++;
VM_OnEventWithDist_(EVENT_EGS, i, pl, p);

View file

@ -318,7 +318,7 @@ extern uint32_t g_frameDelay;
extern user_defs ud;
int32_t A_CheckInventorySprite(spritetype *s);
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int16_t s_pn,int8_t s_s,uint8_t s_xr,uint8_t s_yr,int16_t s_a,int16_t s_ve,int16_t s_zv,int16_t s_ow,int16_t s_ss);
int32_t A_Spawn(int32_t j,int32_t pn);
int32_t G_DoMoveThings(void);
//int32_t G_EndOfLevel(void);

View file

@ -360,8 +360,8 @@ extern int32_t VM_ResetPlayer2(int32_t snum, int32_t flags);
extern void A_RadiusDamage(int32_t i, int32_t r, int32_t, int32_t, int32_t, int32_t);
extern void G_OperateSectors(int32_t sn, int32_t ii);
extern void G_OperateActivators(int32_t low,int32_t snum);
extern int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,
int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int16_t s_pn,int8_t s_s,
uint8_t s_xr,uint8_t s_yr,int16_t s_a,int16_t s_ve,int16_t s_zv,int16_t s_ow,int16_t s_ss);
extern void A_AddToDeleteQueue(int32_t i);
extern int32_t A_PlaySound(uint32_t num, int32_t i);
extern void A_DeleteSprite(int32_t s);