Alchemy
Loading...
Searching...
No Matches

object_pairmove.h

Go to the documentation of this file.
1#include "unit/field/field.h"
2#include "types.h"
3#include "field_obj.h"
4#include "game_state.h"
5
6// Imil and Fuchin Falls, and Vale's cave.
7
8/// Moves the character the player controls (in mode 27) and actor id together
9/// by (dx, dz) pixels to the centres of their cells, at a pixel a frame, as
10/// when pushing it; the actor faces the way it goes.
11static void SceneActor_PlacePairAtOffset(s32 id, s32 dx, s32 dz) {
12 struct FieldActor *actor;
13 struct FieldActor *other;
14 s32 x;
15 s32 z;
16
18 other = Object_GetById(id);
20 {
21 x = ((actor->x.fixed + (dx << 16)) & 0xFFF00000) + 0x80000;
22 z = ((actor->z.fixed + (dz << 16)) & 0xFFF00000) + 0x80000;
23
24 actor->speed = 0x10000;
25 actor->acceleration = 0x8000;
26 Engine_ObjectSetPosition(actor, x, actor->y.fixed, z);
27 }
28 Object_SetMode(actor, 27);
29 {
30 x = ((other->x.fixed + (dx << 16)) & 0xFFF00000) + 0x80000;
31 z = ((other->z.fixed + (dz << 16)) & 0xFFF00000) + 0x80000;
32
33 other->speed = 0x10000;
34 other->acceleration = 0x8000;
35 Engine_ObjectSetPosition(other, x, other->y.fixed, z);
36 }
37 if (dx < 0 || dz < 0) {
38 Object_SetMode(other, 4);
39 } else {
40 Object_SetMode(other, 3);
41 }
44}
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void Engine_ObjectSetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
void Object_SetMode(struct FieldActor *object, s32 animation)
Field objects and actors, and the scene transition styles.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
static void SceneActor_PlacePairAtOffset(s32 id, s32 dx, s32 dz)
Moves the character the player controls (in mode 27) and actor id together by (dx,...
void Engine_EventEnd(void)
void Engine_EventBegin(void)
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
s32 speed
speed limit, 16.16 fixed-point pixels per frame
Definition field_obj.h:55
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
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
Definition field_obj.h:58
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