Skip to content

Commit

Permalink
Target flags - replace numbers with enum
Browse files Browse the repository at this point in the history
  • Loading branch information
jerethk committed Dec 31, 2024
1 parent bcef32c commit 0e7ebf3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions TheForceEngine/TFE_DarkForces/Actor/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ namespace TFE_DarkForces
{
// Move vertically to the middle of the gap
target->pos.y = floorHeight - (TFE_Jedi::abs(gap) >> 1) + (TFE_Jedi::abs(obj->worldHeight) >> 1);
target->flags |= 2;
target->flags |= TARGET_MOVE_Y;
return JFALSE;
}
}
Expand Down Expand Up @@ -765,7 +765,7 @@ namespace TFE_DarkForces
actor_setDeathCollisionFlags();
sound_stop(logic->alertSndID);
sound_playCued(damageMod->dieSndSrc, obj->posWS);
attackMod->target.flags |= 8;
attackMod->target.flags |= 8; // possibly an error? FREEZE (bit 3) has already been added to target flags above
if (obj->type == OBJ_TYPE_SPRITE)
{
actor_setupAnimation(ANIM_DIE2, anim);
Expand Down Expand Up @@ -1542,9 +1542,9 @@ namespace TFE_DarkForces
// Updates the actor target with the passed in target based on the flags.
JBool defaultUpdateTargetFunc(MovementModule* moveMod, ActorTarget* target)
{
if (target->flags & 8)
if (target->flags & TARGET_FREEZE)
{
moveMod->target.flags |= 8;
moveMod->target.flags |= TARGET_FREEZE;
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions TheForceEngine/TFE_DarkForces/Actor/dragon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace TFE_DarkForces
{
task_localBlockBegin;
ActorTarget* target = &local(physicsActor)->moveMod.target;
target->flags |= 8;
target->flags |= TARGET_FREEZE;
memcpy(&local(tmpAnim), local(anim), sizeof(LogicAnimation) - 4);

local(anim)->flags |= AFLAG_PLAYONCE;
Expand All @@ -137,7 +137,7 @@ namespace TFE_DarkForces
actor_setupBossAnimation(local(obj), local(anim)->animId, local(anim));

ActorTarget* target = &local(physicsActor)->moveMod.target;
target->flags &= 0xfffffff7;
target->flags &= ~TARGET_FREEZE;
task_localBlockEnd;
}
msg = MSG_DAMAGE;
Expand Down Expand Up @@ -305,13 +305,13 @@ namespace TFE_DarkForces
fixed16_16 sinYaw, cosYaw;
sinCosFixed(obj->yaw, &sinYaw, &cosYaw);

target->flags |= 4;
target->flags |= TARGET_MOVE_ROT;
target->speedRotation = 6826;

fixed16_16 animSpeed = s_kellDragonAnim[dragon->animIndex].speed;
target->pos.x = obj->posWS.x + mul16(sinYaw, animSpeed);
target->pos.z = obj->posWS.z + mul16(cosYaw, animSpeed);
target->flags |= 1;
target->flags |= TARGET_MOVE_XZ;
}

void kellDragon_handleState1(MessageType msg)
Expand Down Expand Up @@ -1107,7 +1107,7 @@ namespace TFE_DarkForces
physics->height = obj->worldHeight + HALF_16;

ActorTarget* target = &physicsActor->moveMod.target;
target->flags &= 0xfffffff0;
target->flags &= ~TARGET_ALL;
target->speedRotation = 43546; // 956.8 degrees per second.
target->speed = FIXED(10);

Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_DarkForces/Actor/exploders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace TFE_DarkForces
moveMod->physics.width = obj->worldWidth;

ActorTarget* target = &module->attackMod.target;
target->flags = (target->flags | 8) & 0xfffffff8;
target->flags = (target->flags | TARGET_FREEZE) & ~TARGET_ALL_MOVE;
target->speed = 0;
target->speedRotation = 0;

Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_DarkForces/Actor/phaseOne.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ namespace TFE_DarkForces
physicsActor->moveMod.collisionFlags &= ~ACTORCOL_BIT2;

ActorTarget* target = &physicsActor->moveMod.target;
target->flags &= 0xfffffff0;
target->flags &= ~TARGET_ALL;
target->speed = FIXED(30);
target->speedRotation = 0x3000;

Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_DarkForces/Actor/phaseTwo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ namespace TFE_DarkForces
physicsActor->moveMod.physics.yPos = COL_INFINITY;

ActorTarget* target = &physicsActor->moveMod.target;
target->flags &= 0xfffffff0;
target->flags &= ~TARGET_ALL;
target->speed = FIXED(15);
target->speedVert = FIXED(10);
target->speedRotation = 0x3000;
Expand Down
4 changes: 2 additions & 2 deletions TheForceEngine/TFE_DarkForces/Actor/turret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ namespace TFE_DarkForces
// Set a new random target.
target->yaw = random(ANGLE_MAX);
target->pitch = (-random(TURRET_PITCH_RANGE)) & ANGLE_MASK;
target->flags = (target->flags | 4) & 0xfffffffe;
target->flags = (target->flags | TARGET_MOVE_ROT) & (~TARGET_MOVE_XZ);
target->speedRotation = TURRET_OUT_OF_CONTROL_ROTATE_SPD;
}
}
Expand Down Expand Up @@ -606,7 +606,7 @@ namespace TFE_DarkForces

ActorTarget* target = &physicsActor->moveMod.target;
target->speed = 0;
target->flags &= 0xfffffff0;
target->flags &= ~TARGET_ALL;
target->speedRotation = TURRET_ROTATION_SPD;
target->pitch = obj->pitch;
target->yaw = obj->yaw;
Expand Down
2 changes: 1 addition & 1 deletion TheForceEngine/TFE_DarkForces/Actor/welder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ namespace TFE_DarkForces

target->speed = 0;
target->speedRotation = 4551; // ~100 degrees/second.
target->flags &= 0xfffffff0;
target->flags &= ~TARGET_ALL;
target->pitch = obj->pitch;
target->yaw = obj->yaw;
target->roll = obj->roll;
Expand Down

0 comments on commit 0e7ebf3

Please sign in to comment.