Alchemy
Loading...
Searching...
No Matches

colosso_occupant.h

Go to the documentation of this file.
1#include "types.h"
2#include "field_obj.h"
3#include "field_runtime.h"
4#include "game_state.h"
5
6// The Colosso finals' three courses (Colosso Log, River and Wall).
7
8/// Returns the placed actor standing one cell, or else two cells, ahead of the
9/// actor the player moves (straight ahead in the nearest of the four
10/// directions), or 0 when there is none.
12 struct FieldActor *record;
13 s32 facing;
14 struct FieldPosition position;
15 struct FieldActor *occupant;
16
18
19 facing = (record->facing + 0x2000) & 0xc000;
20
21 position.x = (record->x.fixed & 0xfff00000) + 0x80000;
22 position.y = record->y.fixed;
23 position.z = (record->z.fixed & 0xfff00000) + 0x80000;
24 Vector_AddPolarOffset(0x100000, facing, &position);
25
26 occupant = SceneData_FindSlotAtPosition(&position, record);
27 if (occupant == 0) {
28 position.x = (record->x.fixed & 0xfff00000) + 0x80000;
29 position.y = record->y.fixed;
30 position.z = (record->z.fixed & 0xfff00000) + 0x80000;
31 Vector_AddPolarOffset(0x200000, facing, &position);
32
33 occupant = SceneData_FindSlotAtPosition(&position, record);
34 }
35
36 return occupant;
37}
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Field objects and actors, and the scene transition styles.
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
Definition math.c:23
void * Colosso_FindActorAhead(void)
Returns the placed actor standing one cell, or else two cells, ahead of the actor the player moves (s...
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
union FieldCoordinate x
16.16 fixed-point pixels
Definition field_obj.h:35
union FieldCoordinate y
16.16 fixed-point pixels
Definition field_obj.h:36
union FieldCoordinate z
16.16 fixed-point pixels
Definition field_obj.h:37
u16 facing
1/65536 turns
Definition field_obj.h:34
A position on the field.
s32 z
16.16 fixed-point pixels
s32 selectedActor
the leader: its unit and its actor
Definition game_state.h:59
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
s32 fixed
16.16 fixed-point pixels