7#define WORLD_MAP_MARKER_TILE_BYTES 0x80
8#define WORLD_MAP_SCREEN_WIDTH 240
9#define WORLD_MAP_SCREEN_HEIGHT 160
10#define WORLD_MAP_WORLD_SIZE 4096
11#define WORLD_MAP_X_ORIGIN PIXELS(4096)
12#define WORLD_MAP_FIRST_PLACE_ACTOR 11
13#define WORLD_MAP_MARKER_CAPACITY 66
14#define WORLD_MAP_CURSOR_PART WORLD_MAP_MARKER_CAPACITY
15#define WORLD_MAP_CURSOR_MIN_SPEED PIXELS(1)
16#define WORLD_MAP_CURSOR_MAX_SPEED PIXELS(6)
17#define WORLD_MAP_CURSOR_ACCELERATION (PIXELS(1) / 8)
18#define WORLD_MAP_MARKER_BLEND_STEPS 32
19#define WORLD_MAP_CURSOR_MIN_X 16
20#define WORLD_MAP_CURSOR_MAX_X (WORLD_MAP_SCREEN_WIDTH - 1)
21#define WORLD_MAP_CURSOR_MAX_Y 141
30#define WORLD_MAP_MARKER_VIEW(marker) ((marker)->sprite)
32#define WORLD_MAP_MARKER_VIEW(marker) (*(marker))
41#define WORLD_MAP_MARKER_ALLOCATION_SIZE WORLD_MAP_MARKER_TILE_BYTES
43#define WORLD_MAP_MARKER_ALLOCATION_SIZE 32
70 sizeof(((
struct FieldWork *)0)->actors[0]));
102 markerTiles[0] = 255;
103 markerTiles[1] = 0x1ff;
104 markerTiles[2] = 272;
106 markerTiles[9] = 324;
107 markerTiles[10] = 272;
108 markerTiles[16] = 119;
109 markerTiles[17] = 0x177;
110 markerTiles[18] = 272;
111 markerTiles[24] = 0xff0;
112 markerTiles[25] = 0xffff;
113 markerTiles[26] = 0x1ffff;
114 markerTiles[27] = 0x11ff0;
115 markerTiles[28] = 0x1100;
121 marker->
words[0] = 0;
122 marker->
words[1] = 0;
123 marker->
words[2] = tileAttributes;
128 *oam++ = tileAttributes;
149 marker->
words[0] = 0;
150 marker->
words[1] = 0x40000000;
155 cursorAttributes = 0x400;
156 cursorAttributes |= tile >> 5;
158 marker->
words[2] = cursorAttributes;
160 *oam = cursorAttributes;
166#define WORLD_MAP_CURSOR_SNAPS 1
167#define WORLD_MAP_NAME_RANGE 64
168#define WORLD_MAP_NAME_LEFT 3
170#define WORLD_MAP_CURSOR_SNAPS 0
171#define WORLD_MAP_NAME_RANGE 100
172#define WORLD_MAP_NAME_LEFT 1
194 s32 nearestDistanceSquared;
219#if WORLD_MAP_CURSOR_SNAPS
246 if (placeActor ==
NULL)
249 if (placeActor !=
NULL) {
258 if (angle != 0xffff) {
289 if (markerIndex == 0) {
300#if WORLD_MAP_CURSOR_SNAPS
315 if (placeActor ==
NULL)
329 if (width * width + height * height < nearestDistanceSquared) {
333 if (markerIndex != 0)
335 nearestName = message;
337 nearestMarker = markerIndex;
338 nearestDistanceSquared = width * width + height * height;
346#if WORLD_MAP_CURSOR_SNAPS
349 if (nearestMarker != -1) {
350 if (nearestDistanceSquared <= 1) {
376 if (nearestMarker != -1 && (
gFrameCount & 15) <= 7) {
395 if (nearestMarker != -1) {
396 if (nearestMarker == 0)
397 nearestName = MsgPresentLocation;
434 u8 savedFlags[
sizeof(map->
anim) /
sizeof(map->
anim[0])];
448 for (i = 0; i < (
s32)(
sizeof(savedFlags) /
sizeof(savedFlags[0])); i++) {
449 savedFlags[i] = layer->
paused;
483 for (i = 0; i < (
s32)(
sizeof(savedFlags) /
sizeof(savedFlags[0])); i++) {
484 layer->
paused = savedFlags[i];
510 left = x - (320 << 16);
511 right = x + (320 << 16);
513 top = y - (600 << 16);
514 bottom = y + (400 << 16);
524 if (ox < left || ox > right || oy < top || oy > bottom) {
525 object->animationKind = 0;
527 object->animationKind = 1;
554#undef WORLD_MAP_MARKER_TILE_BYTES
555#undef WORLD_MAP_SCREEN_WIDTH
556#undef WORLD_MAP_SCREEN_HEIGHT
557#undef WORLD_MAP_WORLD_SIZE
558#undef WORLD_MAP_X_ORIGIN
559#undef WORLD_MAP_FIRST_PLACE_ACTOR
560#undef WORLD_MAP_MARKER_CAPACITY
561#undef WORLD_MAP_CURSOR_PART
562#undef WORLD_MAP_CURSOR_MIN_SPEED
563#undef WORLD_MAP_CURSOR_MAX_SPEED
564#undef WORLD_MAP_CURSOR_ACCELERATION
565#undef WORLD_MAP_MARKER_BLEND_STEPS
566#undef WORLD_MAP_CURSOR_MIN_X
567#undef WORLD_MAP_CURSOR_MAX_X
568#undef WORLD_MAP_CURSOR_MAX_Y
569#undef WORLD_MAP_MARKER_VIEW
570#undef WORLD_MAP_MARKER_ALLOCATION_SIZE
571#undef WORLD_MAP_CURSOR_SNAPS
572#undef WORLD_MAP_NAME_RANGE
573#undef WORLD_MAP_NAME_LEFT
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
const s32 gWorldMap_PlaceMarkers[]
#define SCHEDULER_KEY_MAIN_LOOP
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
void Map_LoadAreaGraphicsFar(void)
s32 GameFlag_TestFar(s32 flag)
void RenderOutput_PrepareForRedrawFar(struct UiWindow *window)
struct UiWindow * UiWindow_CreateFar(s32 x, s32 y, s32 width, s32 height, s32 attrs)
void UiText_ShowPositionedMessageAndWaitFar(s32 no, s32 flags)
void UiText_MeasureResourceEntriesFar(s32 no, s32 *x, s32 *y)
void UiText_DrawResourceFar(s32 arg0, struct UiWindow *arg1, s32 arg2, s32 arg3)
void UiWork_FinalizeFar(struct UiWindow *work, s32 release)
s32 Resource_LoadFixedBlockBIntoFreeSlotFar(void)
#define FLAG_NOT_ON_MAP
the current place is not on the world map
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
const u16 gWorldMap_CursorDirectionAngles[16]
An angle for each +Control Pad direction (eight of them); 0xffff for none.
const u8 gWorldMap_MarkerBlendCycle[32]
The brightness of the world map markers ((gFrameCount >> 1) & 31).
struct GameState gGameState
struct EffectStep gMapCellBuffer[]
Map cells; battle effects reuse this as a particle array.
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define BGCNT_SCREEN_BASE(block)
#define IO_WRITE_16
Writes a halfword.
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped...
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
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,...
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
void MemFree(void *buffer)
s32 Scene_GetAreaNameIndex(s32 scene, s32 entrance)
Returns the place name of scene and entrance, from the first rule matching the scene or its group; 0 ...
void Leader_StopMoving(void)
Stops the leader where it stands: no horizontal velocity, the normal walking speed (1....
void Event_FinishScreenTransition(void)
The event command "close screen": finishes the event's screen transition and clears work->transitionA...
void Event_WaitTransitionFrames(void)
The event command "wait for screen": waits as long as the transition runs (work->transitionFrames).
void Event_StartScreenTransition(void)
The event command "open screen": starts the event's screen transition and sets work->transitionActive...
void BattleFx_ScheduleRatioTransition(s32 zoom, s32 frames)
Starts a zoom to zoom (16.16) over frames frames, on the world map (event mode 3) only.
#define WORLD_MAP_CURSOR_MAX_SPEED
#define WORLD_MAP_X_ORIGIN
#define WORLD_MAP_MARKER_TILE_BYTES
#define WORLD_MAP_CURSOR_MIN_SPEED
#define WORLD_MAP_NAME_LEFT
#define WORLD_MAP_MARKER_CAPACITY
void BattleFx_RunVisibilityTransition(void)
On the world map, zooms the view out (0x9d89) while L is held, then back.
#define WORLD_MAP_FIRST_PLACE_ACTOR
void Map_UpdateWorldMapMarkers(void)
Scheduler callback of the world map screen: shows a marker at each place whose flag is set,...
#define WORLD_MAP_WORLD_SIZE
#define WORLD_MAP_CURSOR_MIN_X
#define WORLD_MAP_CURSOR_MAX_X
void BattleFx_SetupResourcesAndWindow(void)
Sets up the world map screen: the marker tiles and their OAM entries, the cursor where the leader is ...
#define WORLD_MAP_SCREEN_HEIGHT
#define WORLD_MAP_MARKER_BLEND_STEPS
#define WORLD_MAP_SCREEN_WIDTH
void Map_ShowWorldMap(s32 picture)
Borrows the map-cell buffer for the still map until A or B closes it.
void Field_UpdateObjectVisibilityBounds(void)
On the world map, shows only the scene actors within 320 pixels sideways, 600 above and 400 below the...
#define WORLD_MAP_MARKER_VIEW(marker)
#define WORLD_MAP_CURSOR_ACCELERATION
#define WORLD_MAP_CURSOR_PART
void BattleFx_CleanupResourcesAndWindow(void)
Closes the world map screen: returns its VRAM blocks and removes the place-name window.
#define WORLD_MAP_CURSOR_MAX_Y
#define WORLD_MAP_NAME_RANGE
#define WORLD_MAP_MARKER_ALLOCATION_SIZE
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
#define Ram_MapCellBuffer
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
char ResourceId_WorldMapPicture
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
s32 Scheduler_ResumeOverlayTasks(void)
Resumes every task whose routine is in an overlay, flagged or not.
s32 Scheduler_SuspendOverlayTasks(void)
Suspends every task whose routine is in an overlay (EWRAM, 0x02xxxxxx) unless its flag bit 0 asks to ...
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
struct EventWork * gEventWork
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
The hardware sprite attributes one part of an animated sprite (its image or its shadow) is drawn with...
u16 y
The OAM entry's attributes 0 to 2.
A field actor: a person or thing on the field with a position, motion toward a target,...
union FieldCoordinate x
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
s32 z
16.16 fixed-point pixels
Full event work allocated by Field_RunScene (heap slot 27).
struct ObjectRuntime * camera
the object the map view follows
s16 mode
MODE_WORLD_MAP (3) on the world map.
s32 transitionFrames
frames; 16 on entry and at each event
s32 selectedActor
the leader: its unit and its actor
One of the 16 tile animation channels, which copy tiles into VRAM by script.
The map work in heap slot 8 (struct MapScrollWork), seen as its tile animation channels,...
struct MapAnimation anim[16]
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
u8 movementState
nonzero skips its script and motion (paused)
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
The object system's work: the flag that suspends sprite projection, the outline's edge and fill colou...
s16 suspended
nonzero while a menu has suspended sprite projection
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
u16 offset
bytes from the start of OBJ VRAM
Scratch work while Map_ShowWorldMap owns gMapCellBuffer.
union FieldCoordinate cursorX
screen column, 16.16 pixels
u8 padding0c[6]
not read by this screen
struct AnimationSpritePart markers[WORLD_MAP_MARKER_CAPACITY+1]
s32 cursorSpeed
16.16 screen pixels per frame
u16 cursorVramBlock
owns the cursor picture's tiles
u8 padding14[4]
not read by this screen
u16 markerVramBlock
owns the four generated marker tiles
union FieldCoordinate cursorY
screen row, 16.16 pixels
s16 namedMarker
actor whose name is drawn; -1 clears the name
struct UiWindow * nameWindow
owned until this screen closes
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
A field coordinate, read whole or as its fraction and its whole pixels.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
The renderer's linked sprite entry and the three words that initialize it.
struct AnimationSpritePart sprite
#define MODE_WORLD_MAP
the world map
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.
struct VramBlockCacheEntry gVramBlockCache[]