diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index ad6c4863c..a1062d94d 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -3783,17 +3783,18 @@ NUKE_REPLACEMENT: } } -bool ItemSpotClear(SPRITEp sip, short statnum, short id) +bool ItemSpotClear(DSWActor* actor, short statnum, short id) { bool found = false; int i; + auto sip = &actor->s(); if (TEST_BOOL2(sip)) { - SectIterator it(sip->sectnum); - while ((i = it.NextIndex()) >= 0) + SWSectIterator it(sip->sectnum); + while (auto itActor = it.Next()) { - if (sprite[i].statnum == statnum && User[i]->ID == id) + if (itActor->s().statnum == statnum && itActor->u()->ID == id) { found = true; break; @@ -4154,7 +4155,7 @@ int SpawnItemsMatch(short match) break; case 40: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_REPAIR_KIT)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_REPAIR_KIT)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_REPAIR_KIT, s_RepairKit, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4165,7 +4166,7 @@ int SpawnItemsMatch(short match) break; case 41: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_STAR)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_STAR)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_STAR, s_IconStar, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4176,7 +4177,7 @@ int SpawnItemsMatch(short match) break; case 42: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_LG_MINE)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_MINE)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_MINE, s_IconLgMine, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4187,7 +4188,7 @@ int SpawnItemsMatch(short match) break; case 43: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_MICRO_GUN)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MICRO_GUN)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_GUN, s_IconMicroGun, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4198,7 +4199,7 @@ int SpawnItemsMatch(short match) break; case 44: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_MICRO_BATTERY)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MICRO_BATTERY)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_BATTERY, s_IconMicroBattery, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4209,7 +4210,7 @@ int SpawnItemsMatch(short match) break; case 45: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_GRENADE_LAUNCHER)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GRENADE_LAUNCHER)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_GRENADE_LAUNCHER, s_IconGrenadeLauncher, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4220,7 +4221,7 @@ int SpawnItemsMatch(short match) break; case 46: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_LG_GRENADE)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_GRENADE)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_GRENADE, s_IconLgGrenade, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4231,7 +4232,7 @@ int SpawnItemsMatch(short match) break; case 47: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_RAIL_GUN)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_RAIL_GUN)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_GUN, s_IconRailGun, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4242,7 +4243,7 @@ int SpawnItemsMatch(short match) break; case 48: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_RAIL_AMMO)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_RAIL_AMMO)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_AMMO, s_IconRailAmmo, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4253,7 +4254,7 @@ int SpawnItemsMatch(short match) break; case 49: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_ROCKET)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_ROCKET)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_ROCKET, s_IconRocket, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4264,7 +4265,7 @@ int SpawnItemsMatch(short match) break; case 51: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_SHOTGUN)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_SHOTGUN)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_SHOTGUN, s_IconShotgun, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4275,7 +4276,7 @@ int SpawnItemsMatch(short match) break; case 52: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_LG_SHOTSHELL)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_SHOTSHELL)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_SHOTSHELL, s_IconLgShotshell, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4286,7 +4287,7 @@ int SpawnItemsMatch(short match) break; case 53: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_GUARD_HEAD)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GUARD_HEAD)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4297,7 +4298,7 @@ int SpawnItemsMatch(short match) break; case 54: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_FIREBALL_LG_AMMO)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_FIREBALL_LG_AMMO)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_FIREBALL_LG_AMMO, s_IconFireballLgAmmo, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4308,7 +4309,7 @@ int SpawnItemsMatch(short match) break; case 55: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_HEART)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4319,7 +4320,7 @@ int SpawnItemsMatch(short match) break; case 56: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_HEART_LG_AMMO)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART_LG_AMMO)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART_LG_AMMO, s_IconHeartLgAmmo, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4332,7 +4333,7 @@ int SpawnItemsMatch(short match) case 57: { USERp u; - if (!ItemSpotClear(sip, STAT_ITEM, ICON_ARMOR)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_ARMOR)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_ARMOR, s_IconArmor, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4351,7 +4352,7 @@ int SpawnItemsMatch(short match) } case 58: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_MEDKIT)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MEDKIT)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_MEDKIT, s_IconMedkit, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4362,7 +4363,7 @@ int SpawnItemsMatch(short match) break; case 59: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_SM_MEDKIT)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_SM_MEDKIT)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_SM_MEDKIT, s_IconSmMedkit, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4373,7 +4374,7 @@ int SpawnItemsMatch(short match) break; case 60: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_CHEMBOMB)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CHEMBOMB)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_CHEMBOMB, s_IconChemBomb, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4384,7 +4385,7 @@ int SpawnItemsMatch(short match) break; case 61: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_FLASHBOMB)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_FLASHBOMB)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_FLASHBOMB, s_IconFlashBomb, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4395,7 +4396,7 @@ int SpawnItemsMatch(short match) break; case 62: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_NUKE)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_NUKE)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_NUKE, s_IconNuke, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4406,7 +4407,7 @@ int SpawnItemsMatch(short match) break; case 63: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_CALTROPS)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CALTROPS)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_CALTROPS, s_IconCaltrops, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4417,7 +4418,7 @@ int SpawnItemsMatch(short match) break; case 64: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_BOOSTER)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_BOOSTER)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_BOOSTER, s_IconBooster, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4428,7 +4429,7 @@ int SpawnItemsMatch(short match) break; case 65: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_HEAT_CARD)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEAT_CARD)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_HEAT_CARD, s_IconHeatCard, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4439,7 +4440,7 @@ int SpawnItemsMatch(short match) break; case 66: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_CLOAK)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CLOAK)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_CLOAK, s_IconCloak, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4450,7 +4451,7 @@ int SpawnItemsMatch(short match) break; case 67: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_NIGHT_VISION)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_NIGHT_VISION)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_NIGHT_VISION, s_IconNightVision, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4462,7 +4463,7 @@ int SpawnItemsMatch(short match) case 68: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_LG_UZI_AMMO)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_UZI_AMMO)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_UZI_AMMO, s_IconLgUziAmmo, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4473,7 +4474,7 @@ int SpawnItemsMatch(short match) break; case 69: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_GUARD_HEAD)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GUARD_HEAD)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4484,7 +4485,7 @@ int SpawnItemsMatch(short match) break; case 70: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_HEART)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4496,7 +4497,7 @@ int SpawnItemsMatch(short match) case 20: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_UZIFLOOR)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_UZIFLOOR)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_UZIFLOOR, s_IconUziFloor, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4510,7 +4511,7 @@ int SpawnItemsMatch(short match) case 32: case 0: - if (!ItemSpotClear(sip, STAT_ITEM, ICON_UZI)) + if (!ItemSpotClear(itActor, STAT_ITEM, ICON_UZI)) break; spawnedActor = SpawnActor(STAT_ITEM, ICON_UZI, s_IconUzi, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0); @@ -4557,7 +4558,7 @@ int SpawnItemsMatch(short match) num = SP_TAG3(sip) - 1; - if (!ItemSpotClear(sip, STAT_ITEM, s_Key[num]->Pic)) + if (!ItemSpotClear(itActor, STAT_ITEM, s_Key[num]->Pic)) break; spawnedActor = SpawnActor(STAT_ITEM, s_Key[num]->Pic, s_Key[num], sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0);