Tidy top down scene
@@ -21,49 +21,11 @@ void Start_TopDown() {
}
void Update_TopDown() {
- UBYTE tile_x, tile_y, hit_actor, hit_trigger, a, i, rnd;
+ UBYTE tile_x, tile_y, hit_actor, hit_trigger;
tile_x = player.pos.x >> 3;
tile_y = player.pos.y >> 3;
- // Cleanup after script complete -------------------------------
-
- // if (script_complete) {
- // ActorsUnstick();
- // }
-
- // NPC Logic ---------------------------------------------------
-
- // for (i = 1; i < actors_active_size; i++) {
- // a = actors_active[i];
- // if (actors[a].movement_type == AI_RANDOM_WALK) {
- // if (ActorOnTile(a)) {
- // if (IS_FRAME_128) {
- // rnd = rand();
- // if (rnd & 0x1u) {
- // rnd = rand();
- // ActorSetMovement(a, 1 - ((rnd & 0x1u) * 2), 0);
- // } else {
- // rnd = rand();
- // ActorSetMovement(a, 0, 1 - ((rnd & 0x1u) * 2));
- // }
- // } else {
- // ActorStopMovement(a);
- // }
- // }
- // } else if (actors[a].movement_type == AI_RANDOM_FACE) {
- // if (IS_FRAME_128) {
- // rnd = rand();
- // actors[a].dir.x = 1 - ((rnd & 0x1u) * 2);
- // rnd = rand();
- // actors[a].dir.y = 1 - ((rnd & 0x1u) * 2);
- // actors[a].rerender = TRUE;
- // }
- // }
- // }
-
- // Player Logic ------------------------------------------------
-
if (PlayerOnTile()) {
// If player was moving on the previous frame
if (player.moving) {
@@ -74,7 +36,7 @@ void Update_TopDown() {
PlayerStopMovement();
// Run trigger script
- ScriptStart(&triggers[hit_trigger].events_ptr);
+ TriggerRunScript(hit_trigger);
return;
}
}
@@ -108,9 +70,7 @@ void Update_TopDown() {
PlayerStopMovement();
// Run actors interact script
- script_main_ctx_actor = hit_actor;
- actors[hit_actor].moving = FALSE;
- ScriptStart(&actors[hit_actor].events_ptr);
+ ActorRunScript(hit_actor);
}
}
}
