Readability improvements for gamestructures.cpp

git-svn-id: https://svn.eduke32.com/eduke32@6854 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-04-23 06:36:08 +00:00
parent 21c9f6dd7e
commit e682986e69

View file

@ -64,10 +64,10 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
case USERDEFS_SHOW_HELP: labelNum = ud.show_help; break;
case USERDEFS_SCROLLMODE: labelNum = ud.scrollmode; break;
case USERDEFS_CLIPPING: labelNum = ud.noclip; break;
// case USERDEFS_USER_NAME: labelNum= ud.user_name[MAXPLAYERS][32]; break;
// case USERDEFS_RIDECULE: labelNum= ud.ridecule; break;
// case USERDEFS_PWLOCKOUT: labelNum= ud.pwlockout; break;
// case USERDEFS_RTSNAME: labelNum= ud.rtsname; break;
// case USERDEFS_USER_NAME: labelNum = ud.user_name[MAXPLAYERS][32]; break;
// case USERDEFS_RIDECULE: labelNum = ud.ridecule; break;
// case USERDEFS_PWLOCKOUT: labelNum = ud.pwlockout; break;
// case USERDEFS_RTSNAME: labelNum = ud.rtsname; break;
case USERDEFS_OVERHEAD_ON: labelNum = ud.overhead_on; break;
case USERDEFS_LAST_OVERHEAD: labelNum = ud.last_overhead; break;
case USERDEFS_SHOWWEAPONS: labelNum = ud.showweapons; break;
@ -159,16 +159,14 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
case USERDEFS_USEVOXELS: labelNum = usevoxels; break;
case USERDEFS_USEHIGHTILE:
#ifdef USE_OPENGL
labelNum = usehightile;
break;
labelNum = usehightile; break;
#endif
case USERDEFS_USEMODELS:
#ifdef USE_OPENGL
labelNum = usemodels;
labelNum = usemodels; break;
#else
labelNum = 0;
labelNum = 0; break;
#endif
break;
case USERDEFS_GAMETYPEFLAGS: labelNum = g_gametypeFlags[ud.coop]; break;
case USERDEFS_M_GAMETYPEFLAGS: labelNum = g_gametypeFlags[ud.m_coop]; break;
case USERDEFS_GLOBALFLAGS: labelNum = globalflags; break;
@ -229,7 +227,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
if (lParm2 == 0)
labelNum = aGameVars[g_returnVarID].global;
else
labelNum = ud.returnvar[lParm2-1];
labelNum = ud.returnvar[lParm2 - 1];
break;
case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break;
case USERDEFS_AUTOSAVE: labelNum = ud.autosave; break;
@ -354,8 +352,16 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const lParm2, int3
case USERDEFS_M_ORIGIN_Y: ud.returnvar[1] = iSet; break;
case USERDEFS_GLOBALFLAGS: globalflags = iSet; break;
case USERDEFS_GLOBALGAMEFLAGS: duke3d_globalflags = iSet; break;
case USERDEFS_VM_PLAYER: vm.playerNum = iSet; vm.pPlayer = g_player[iSet].ps; break;
case USERDEFS_VM_SPRITE: vm.spriteNum = iSet; vm.pSprite = &sprite[iSet]; vm.pActor = &actor[iSet]; vm.pData = &actor[iSet].t_data[0]; break;
case USERDEFS_VM_PLAYER:
vm.playerNum = iSet;
vm.pPlayer = g_player[iSet].ps;
break;
case USERDEFS_VM_SPRITE:
vm.spriteNum = iSet;
vm.pSprite = &sprite[iSet];
vm.pActor = &actor[iSet];
vm.pData = &actor[iSet].t_data[0];
break;
case USERDEFS_VM_DISTANCE: vm.playerDist = iSet; break;
case USERDEFS_GAMETEXT_TRACKING: MF_Bluefont.between.x = iSet; break;
case USERDEFS_MENUTEXT_TRACKING: MF_Redfont.between.x = iSet; break;
@ -419,7 +425,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const lParm2, int3
if (lParm2 == 0)
aGameVars[g_returnVarID].global = iSet;
else
ud.returnvar[lParm2-1] = iSet;
ud.returnvar[lParm2 - 1] = iSet;
break;
case USERDEFS_AUTOSAVE: ud.autosave = iSet; break;
default: break;
@ -851,8 +857,10 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_HOLSTER_WEAPON: ps->holster_weapon = iSet; break;
case PLAYER_FALLING_COUNTER: ps->falling_counter = iSet; break;
case PLAYER_GOTWEAPON:
if (iSet) ps->gotweapon |= (1 << lParm2);
else ps->gotweapon &= ~(1 << lParm2);
if (iSet)
ps->gotweapon |= (1 << lParm2);
else
ps->gotweapon &= ~(1 << lParm2);
break;
case PLAYER_REFRESH_INVENTORY: ps->refresh_inventory = iSet; break;
case PLAYER_PALETTE: P_SetGamePalette(ps, iSet, 2+16); break;
@ -1116,16 +1124,12 @@ void __fastcall VM_SetSector(int32_t const sectNum, int32_t const labelNum, int3
case SECTOR_CEILINGZVEL: pSector->extra = iSet;
if ((iSet = GetAnimationGoal(&pSector->ceilingz)) != -1)
case SECTOR_CEILINGZGOAL:
SetAnimation(sectNum, &pSector->ceilingz, iSet, pSector->extra);
break;
SetAnimation(sectNum, &pSector->ceilingz, iSet, pSector->extra); break;
case SECTOR_FLOORZ: pSector->floorz = iSet; break;
case SECTOR_FLOORZVEL: pSector->extra = iSet;
if ((iSet = GetAnimationGoal(&pSector->floorz)) != -1)
case SECTOR_FLOORZGOAL:
SetAnimation(sectNum, &pSector->floorz, iSet, pSector->extra);
break;
SetAnimation(sectNum, &pSector->floorz, iSet, pSector->extra); break;
case SECTOR_CEILINGSTAT: pSector->ceilingstat = iSet; break;
case SECTOR_FLOORSTAT: pSector->floorstat = iSet; break;
case SECTOR_CEILINGPICNUM: pSector->ceilingpicnum = iSet; break;
@ -1186,10 +1190,10 @@ void __fastcall VM_SetSprite(int32_t const spriteNum, int32_t const labelNum, in
case ACTOR_XVEL: pSprite->xvel = iSet; break;
case ACTOR_YVEL: pSprite->yvel = iSet; break;
case ACTOR_ZVEL: pSprite->zvel = iSet; break;
case ACTOR_LOTAG: pSprite->lotag = (int16_t)iSet; break;
case ACTOR_HITAG: pSprite->hitag = (int16_t)iSet; break;
case ACTOR_ULOTAG: pSprite->lotag = (uint16_t)iSet; break;
case ACTOR_UHITAG: pSprite->hitag = (uint16_t)iSet; break;
case ACTOR_LOTAG: pSprite->lotag = (int16_t) iSet; break;
case ACTOR_HITAG: pSprite->hitag = (int16_t) iSet; break;
case ACTOR_ULOTAG: pSprite->lotag = (uint16_t) iSet; break;
case ACTOR_UHITAG: pSprite->hitag = (uint16_t) iSet; break;
case ACTOR_EXTRA: pSprite->extra = iSet; break;
case ACTOR_HTCGG: actor[spriteNum].cgg = iSet; break;
case ACTOR_HTPICNUM: actor[spriteNum].picnum = iSet; break;
@ -1219,7 +1223,7 @@ void __fastcall VM_SetSprite(int32_t const spriteNum, int32_t const labelNum, in
case ACTOR_XPANNING: spriteext[spriteNum].xpanning = iSet; break;
case ACTOR_YPANNING: spriteext[spriteNum].ypanning = iSet; break;
case ACTOR_HTFLAGS: actor[spriteNum].flags = iSet; break;
case ACTOR_ALPHA: spriteext[spriteNum].alpha = (float)iSet * (1.f / 255.0f); break;
case ACTOR_ALPHA: spriteext[spriteNum].alpha = (float) iSet * (1.f / 255.0f); break;
default: break;
}
}
@ -1258,10 +1262,10 @@ int32_t __fastcall VM_GetSprite(int32_t const spriteNum, int32_t labelNum, int32
case ACTOR_XVEL: labelNum = pSprite->xvel; break;
case ACTOR_YVEL: labelNum = pSprite->yvel; break;
case ACTOR_ZVEL: labelNum = pSprite->zvel; break;
case ACTOR_LOTAG: labelNum = (int16_t)pSprite->lotag; break;
case ACTOR_HITAG: labelNum = (int16_t)pSprite->hitag; break;
case ACTOR_ULOTAG: labelNum = (uint16_t)pSprite->lotag; break;
case ACTOR_UHITAG: labelNum = (uint16_t)pSprite->hitag; break;
case ACTOR_LOTAG: labelNum = (int16_t) pSprite->lotag; break;
case ACTOR_HITAG: labelNum = (int16_t) pSprite->hitag; break;
case ACTOR_ULOTAG: labelNum = (uint16_t) pSprite->lotag; break;
case ACTOR_UHITAG: labelNum = (uint16_t) pSprite->hitag; break;
case ACTOR_EXTRA: labelNum = pSprite->extra; break;
case ACTOR_HTCGG: labelNum = actor[spriteNum].cgg; break;
case ACTOR_HTPICNUM: labelNum = actor[spriteNum].picnum; break;
@ -1291,7 +1295,7 @@ int32_t __fastcall VM_GetSprite(int32_t const spriteNum, int32_t labelNum, int32
case ACTOR_XPANNING: labelNum = spriteext[spriteNum].xpanning; break;
case ACTOR_YPANNING: labelNum = spriteext[spriteNum].ypanning; break;
case ACTOR_HTFLAGS: labelNum = actor[spriteNum].flags; break;
case ACTOR_ALPHA: labelNum = (uint8_t)(spriteext[spriteNum].alpha * 255.0f); break;
case ACTOR_ALPHA: labelNum = (uint8_t) (spriteext[spriteNum].alpha * 255.0f); break;
case ACTOR_ISVALID: labelNum = (sprite[spriteNum].statnum != MAXSTATUS); break;
default: labelNum = -1; break;
}
@ -1503,15 +1507,12 @@ int32_t __fastcall VM_GetTileData(int32_t const tileNum, int32_t labelNum)
{
case TILEDATA_XSIZE: labelNum = tilesiz[tileNum].x; break;
case TILEDATA_YSIZE: labelNum = tilesiz[tileNum].y; break;
case TILEDATA_ANIMFRAMES: labelNum = picanm[tileNum].num; break;
case TILEDATA_XOFFSET: labelNum = picanm[tileNum].xofs; break;
case TILEDATA_YOFFSET: labelNum = picanm[tileNum].yofs; break;
case TILEDATA_ANIMSPEED: labelNum = picanm[tileNum].sf & PICANM_ANIMSPEED_MASK; break;
case TILEDATA_ANIMTYPE: labelNum = (picanm[tileNum].sf & PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT; break;
case TILEDATA_GAMEFLAGS: labelNum = g_tile[tileNum].flags; break;
default: labelNum = -1; break;
}
@ -1536,7 +1537,6 @@ void __fastcall VM_SetTileData(int32_t const tileNum, int32_t labelNum, int32_t
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;
}
}