Alchemy
Loading...
Searching...
No Matches

kolima_jump.h

Go to the documentation of this file.
1/// @file
2/// Kolima's forest bridge and river: the hop east onto actor 10 (the third
3/// placement).
4#include "types.h"
5#include "engine_call.h"
6#include "field_obj.h"
8#include "game_state.h"
9#include "songs.h"
10
11/// Hops the leader to the pixel of the 16.16 position request, unless something
12/// blocks the way: the leader crouches, jumps (3 pixels a frame, rising at 4)
13/// and lands while actor 10 plays its animation 7; the leader is then nudged a
14/// pixel north-west twice and back. Returns 1 after a hop.
16 struct StagedActorEffect *actor = (void *)Object_GetById(0);
17 u8 *flags = &actor->motionFlags;
18 u8 saved = *flags;
20 (struct FieldPosition *)request);
21
22 if (ret == 0) {
24 Object_SetMode((struct FieldActor *)actor, 6);
27 Object_SetMode((struct FieldActor *)actor, 7);
28 actor->moveRateX = 0x30000;
29 actor->moveRateZ = 0x20000;
30 actor->elevationRate = 0x40000;
31 *flags &= 0x7e;
32 Engine_ActorSetSpriteFlags((struct FieldActor *)actor, 0);
34 request->cellZ);
35 Object_SetMode((struct FieldActor *)actor, 6);
36 Engine_ActorSetSpriteFlags((struct FieldActor *)actor, 1);
37 *flags = ret;
39 actor->positionX += 0xffff0000;
40 actor->positionZ += 0xffff0000;
42 actor->positionX += 0xffff0000;
43 actor->positionZ += 0xffff0000;
45 actor->positionX += 0x10000;
46 actor->positionZ += 0x10000;
48 actor->positionX += 0x10000;
49 actor->positionZ += 0x10000;
50 *flags = saved;
52 return 1;
53 }
54 return 0;
55}
56
57/// Touch trigger 11, walking east: hop 30 pixels east of the leader. The
58/// patched editions hop from the centre of the moving character's cell, 40
59/// pixels.
60static void KolimaForest_HopEast(void) {
61 u32 buf[3];
62#if !TBS_PATCH_1
63 buf[0] = Object_GetById(0)->x.fixed + 0x1e0000;
64 buf[1] = Object_GetById(0)->y.fixed;
65 buf[2] = Object_GetById(0)->z.fixed;
66#else
67 // gGameState.selectedActor
68 s32 off = 500;
69 struct FieldActor *p = Object_GetById(*(s32 *)((u8 *)&gGameState + off));
70 u32 base = p->x.fixed & 0xfff00000;
71
72 buf[0] = base + 0x80000;
73 buf[1] = p->y.fixed;
74 buf[2] = (p->z.fixed & 0xfff00000) + 0x80000;
75 buf[0] = base + 0x280000;
76#endif
78}
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void Engine_ActorSetSpriteFlags(struct FieldActor *, s32)
The engine call layer: one typed inline for each of the thirteen main-image routines below that the s...
static s32 FieldObject_CheckMovementCollision(struct FieldActor *actor, struct FieldPosition *position)
Definition engine_call.h:66
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
Field objects and actors, and the scene transition styles.
@ ACTOR_PARTY_LEADER
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
static void KolimaForest_HopEast(void)
Touch trigger 11, walking east: hop 30 pixels east of the leader.
Definition kolima_jump.h:60
static s32 StagedActor_RunStepEffect(struct StagedActorEffectRequest *request)
Hops the leader to the pixel of the 16.16 position request, unless something blocks the way: the lead...
Definition kolima_jump.h:15
Song and sound effect ids, indices into gSound_SongTable.
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
Definition songs.h:147
void Engine_ActorSetAnimation()
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_TaskWait()
A staged actor's effect and its request.
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
A position on the field.
The hop's destination, a 16.16 position read as its whole pixels.
The party leader's actor as Kolima Forest's hop sees it: the coordinates it nudges,...
u8 motionFlags
ActorMotionFlag bits: the hop clears bits 7 and 0, zeroes them all when it lands, then restores them.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned char u8
Definition types.h:11
s32 fixed
16.16 fixed-point pixels