Alchemy
Loading...
Searching...
No Matches

lamakan_desert.c File Reference

Lamakan Desert, four maps of sand between Altin and the world map east. More...

Go to the source code of this file.

Data Structures

struct  SafePoint
 A recovery point: where a collapsed leader comes to. More...
struct  Half
 A halfword holding the zero the gauge's slide and phase are cleared with. More...

Macros

#define NULL   ((void *)0)

Enumerations

enum  {
  FLAG_HAZARDS_PAUSED = FLAG_SCENE_TEMP_00 , FLAG_SECRETS_REVEALED = FLAG_SCENE_TEMP_01 , FLAG_HEAT_QUARTER = 0x300 , FLAG_HEAT_HALF = 0x301 ,
  FLAG_HEAT_THREE_QUARTERS = 0x302 , FLAG_GARET_COMPLAINED = 0x303 , FLAG_IVAN_COMPLAINED = 0x304 , FLAG_MIA_COMPLAINED = 0x305
}
enum  { SAND_MONSTER = 8 , FIRST_PIT = 9 , LAST_PIT = 12 , SMOG = 13 }
enum  { LAMAKAN_ENCOUNTERS = 53 }
 The sand monster's fight and the pits' battles come from encounter zone 53. More...

Functions

static void HeatGauge_SetHeld (u16 value)
 While held (1), the gauge stays on screen.
static void TalkToSmog (void)
 Smog, Jupiter Djinni 3, joins the party.
static s32 Leader_SpraySand (union FieldObject *fieldObject)
const struct SceneEntrance * LamakanDesert_GetEntrances (void)
 Where the party can enter each of the four maps.
const struct SceneRegion * LamakanDesert_GetRegions (void)
const u32 * LamakanDesert_GetExits (void)
 All four desert maps share the packed exit table.
const struct ScenePlacement * LamakanDesert_GetPlacements (void)
 The pits and the monster of each map.
static void LeaveForTheWorldMap (void)
 Trigger 9: back out to the world map.
const struct SceneEvent * LamakanDesert_GetEvents (void)
 The desert's triggers, the same on every map.
static s32 Reveal_HideSecrets (void)
 Reveal's end (phase 4), and every entry: the pits and Smog vanish under the sand again (cells 70, 68 or 69, 99 over the saved patches), the chests hide and the heat haze shimmers.
static s32 Reveal_ShowSecrets (void)
 Reveal (phase 5): the saved patches of sand come back, the pits and the monster stand where they are, the chests show and the haze stops.
static void FightSandMonster (void)
 Talking to the sand monster: its battle, returning to the third map's entrance 5.
static void ComplainAboutHeat (s32 mark)
 Raised trigger 1, 2 or 3 as the heat gauge passes a quarter, a half and three quarters: Garet, Ivan or Mia, picked at random (three tries for one who has not spoken yet), complains about the heat.
static void HeatGauge_RaiseQuarterTriggers (void)
 Every frame: raises triggers 1 to 3 as the gauge passes each quarter, and clears each mark and the complaints when the gauge drops back below it.
static s32 DistanceInPixels (s32 *firstPosition, s32 *secondPosition)
 The distance in whole pixels between two x, z positions.
static void CollapseFromHeat (void)
 Trigger 20, raised when the heat gauge fills: the leader drops at the nearest recovery point of the map, lies collapsed while the gauge drains 5 steps a frame, then gets up.
static void HeatGauge_CountStep (void)
 Walking on sand (triggers 21 and 100 to 107): each moving frame adds a step of heat and kicks up dust, faster on the run.
static void FallIntoPit (void)
 Trigger 22, stepping near a hidden pit: the leader looks at the nearest pit, is pulled backwards into it and a battle begins.
static void SlideDownDune (void)
 Trigger 30, on a slope of sand: the sand carries the leader south 1.5 pixels a frame, and at a ledge the leader hops down 8 pixels.
static void MeetSandMonster (void)
 Trigger 40 on the third map, until the monster is beaten: the leader stops and backs away as the monster rises out of the sand.
s32 LamakanDesert_Initialize (s32 a0, s32 a1)
 Entering the desert: the heat gauge (600 steps) starts on the first three maps, the patches Reveal uncovers are saved to the spare cells at 64, 126 or 64, 124, and the secrets are hidden.
static UNUSED void SandMonster_Return (void)
 The monster sinks back to its spot; nothing calls this.
static void HeatGauge_Draw (void)
 Every frame: draws the heat gauge.
void HeatGauge_Start (void)
 Loads the gauge's tiles, claims VRAM for them and starts drawing it.

Variables

const s32 gEffectScript0 []
const s32 gEffectScript1 []
const s32 gEffectScript2 []
const s32 gLamakanDesertRecoveryPoints1 []
 Each map's recovery points, as x, z pairs.
const s32 gLamakanDesertRecoveryPoints2 []
const s32 gLamakanDesertRecoveryPointsOther []
const s32 * gEffectScripts []
struct SceneEntrance gLamakanDesertEntrancesOther []
struct SceneEntrance gLamakanDesertEntrances1 []
struct SceneEntrance gLamakanDesertEntrances2 []
struct SceneEntrance gLamakanDesertEntrances3 []
struct SceneEntrance gLamakanDesertEntrances4 []
u32 gLamakanDesertExits []
struct ScenePlacement gLamakanDesertPlacementsOther []
struct ScenePlacement gLamakanDesertPlacements1 []
struct ScenePlacement gLamakanDesertPlacements2 []
struct ScenePlacement gLamakanDesertPlacements3 []
struct SceneEvent gLamakanDesertEvents []
s16 gHeatGaugeLevel = 0
 The gauge: how full it is (0 to 120), how far it has slid onto the screen, and a flash as it fills.
s16 gHeatGaugeSlide = 0
s16 gHeatGaugeFlash = 0

Detailed Description

Lamakan Desert, four maps of sand between Altin and the world map east.

Walking fills a heat gauge (gGameState.hazardSteps of hazardLimit), drawn as a bar at the top of the screen; each quarter it fills makes a party member complain, and a full gauge leaves the leader collapsed at the nearest recovery point. Reveal uncovers the hidden pits, the shimmering heat haze hides them again, and a pit drags the leader into a battle.

Definition in file lamakan_desert.c.

Macro Definition Documentation

◆ NULL

#define NULL   ((void *)0)

Definition at line 82 of file lamakan_desert.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FLAG_HAZARDS_PAUSED 

FLAG_SCENE_TEMP_00: a collapse, a pit or the monster is under way.

FLAG_SECRETS_REVEALED 

FLAG_SCENE_TEMP_01: Reveal shows the pits.

FLAG_HEAT_QUARTER 

the gauge has passed a quarter

FLAG_HEAT_HALF 
FLAG_HEAT_THREE_QUARTERS 
FLAG_GARET_COMPLAINED 

Who has complained since the gauge last passed a mark: one per member, in the order of their actors.

FLAG_IVAN_COMPLAINED 
FLAG_MIA_COMPLAINED 

Definition at line 57 of file lamakan_desert.c.

◆ anonymous enum

anonymous enum
Enumerator
SAND_MONSTER 

sprite 0xc3; talking to it starts a battle

FIRST_PIT 

9 to 12: the pits Reveal shows (sprite 0xc1)

LAST_PIT 
SMOG 

the Jupiter Djinni

Definition at line 72 of file lamakan_desert.c.

◆ anonymous enum

anonymous enum

The sand monster's fight and the pits' battles come from encounter zone 53.

Enumerator
LAMAKAN_ENCOUNTERS 

Definition at line 80 of file lamakan_desert.c.

Function Documentation

◆ HeatGauge_SetHeld()

void HeatGauge_SetHeld ( u16 held)
static

While held (1), the gauge stays on screen.

Definition at line 1062 of file lamakan_desert.c.

Referenced by CollapseFromHeat(), HeatGauge_SetHeld(), and MeetSandMonster().

◆ TalkToSmog()

void TalkToSmog ( void )
static

Smog, Jupiter Djinni 3, joins the party.

Definition at line 88 of file lamakan_desert.c.

Referenced by TalkToSmog().

◆ Leader_SpraySand()

s32 Leader_SpraySand ( union FieldObject * fieldObject)
static

Definition at line 99 of file lamakan_desert.c.

Referenced by FallIntoPit(), and Leader_SpraySand().

◆ LamakanDesert_GetEntrances()

const struct SceneEntrance * LamakanDesert_GetEntrances ( void )

Where the party can enter each of the four maps.

Definition at line 129 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ LamakanDesert_GetRegions()

const struct SceneRegion * LamakanDesert_GetRegions ( void )

Definition at line 147 of file lamakan_desert.c.

Referenced by LamakanDesert_GetRegions().

◆ LamakanDesert_GetExits()

const u32 * LamakanDesert_GetExits ( void )

All four desert maps share the packed exit table.

Definition at line 150 of file lamakan_desert.c.

Referenced by LamakanDesert_GetExits().

◆ LamakanDesert_GetPlacements()

const struct ScenePlacement * LamakanDesert_GetPlacements ( void )

The pits and the monster of each map.

Arriving at the third map's entrance 5, the way back from the monster's battle, marks it beaten.

Definition at line 154 of file lamakan_desert.c.

Referenced by LamakanDesert_GetPlacements().

◆ LeaveForTheWorldMap()

void LeaveForTheWorldMap ( void )
static

Trigger 9: back out to the world map.

Definition at line 176 of file lamakan_desert.c.

Referenced by LeaveForTheWorldMap().

◆ LamakanDesert_GetEvents()

const struct SceneEvent * LamakanDesert_GetEvents ( void )

The desert's triggers, the same on every map.

Definition at line 192 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEvents().

◆ Reveal_HideSecrets()

s32 Reveal_HideSecrets ( void )
static

Reveal's end (phase 4), and every entry: the pits and Smog vanish under the sand again (cells 70, 68 or 69, 99 over the saved patches), the chests hide and the heat haze shimmers.

Definition at line 203 of file lamakan_desert.c.

Referenced by LamakanDesert_Initialize(), and Reveal_HideSecrets().

◆ Reveal_ShowSecrets()

s32 Reveal_ShowSecrets ( void )
static

Reveal (phase 5): the saved patches of sand come back, the pits and the monster stand where they are, the chests show and the haze stops.

Definition at line 272 of file lamakan_desert.c.

Referenced by Reveal_ShowSecrets().

◆ FightSandMonster()

void FightSandMonster ( void )
static

Talking to the sand monster: its battle, returning to the third map's entrance 5.

Definition at line 339 of file lamakan_desert.c.

Referenced by FightSandMonster().

◆ ComplainAboutHeat()

void ComplainAboutHeat ( s32 mark)
static

Raised trigger 1, 2 or 3 as the heat gauge passes a quarter, a half and three quarters: Garet, Ivan or Mia, picked at random (three tries for one who has not spoken yet), complains about the heat.

Definition at line 349 of file lamakan_desert.c.

Referenced by ComplainAboutHeat().

◆ HeatGauge_RaiseQuarterTriggers()

void HeatGauge_RaiseQuarterTriggers ( void )
static

Every frame: raises triggers 1 to 3 as the gauge passes each quarter, and clears each mark and the complaints when the gauge drops back below it.

Nothing is raised while Reveal is showing the pits.

Definition at line 380 of file lamakan_desert.c.

Referenced by HeatGauge_RaiseQuarterTriggers(), and LamakanDesert_Initialize().

◆ DistanceInPixels()

s32 DistanceInPixels ( s32 * firstPosition,
s32 * secondPosition )
static

The distance in whole pixels between two x, z positions.

Definition at line 419 of file lamakan_desert.c.

Referenced by CollapseFromHeat(), and DistanceInPixels().

◆ CollapseFromHeat()

void CollapseFromHeat ( void )
static

Trigger 20, raised when the heat gauge fills: the leader drops at the nearest recovery point of the map, lies collapsed while the gauge drains 5 steps a frame, then gets up.

Definition at line 437 of file lamakan_desert.c.

Referenced by CollapseFromHeat().

◆ HeatGauge_CountStep()

void HeatGauge_CountStep ( void )
static

Walking on sand (triggers 21 and 100 to 107): each moving frame adds a step of heat and kicks up dust, faster on the run.

Definition at line 572 of file lamakan_desert.c.

Referenced by HeatGauge_CountStep(), MeetSandMonster(), and SlideDownDune().

◆ FallIntoPit()

void FallIntoPit ( void )
static

Trigger 22, stepping near a hidden pit: the leader looks at the nearest pit, is pulled backwards into it and a battle begins.

Definition at line 622 of file lamakan_desert.c.

Referenced by FallIntoPit().

◆ SlideDownDune()

void SlideDownDune ( void )
static

Trigger 30, on a slope of sand: the sand carries the leader south 1.5 pixels a frame, and at a ledge the leader hops down 8 pixels.

Definition at line 697 of file lamakan_desert.c.

Referenced by SlideDownDune().

◆ MeetSandMonster()

void MeetSandMonster ( void )
static

Trigger 40 on the third map, until the monster is beaten: the leader stops and backs away as the monster rises out of the sand.

Definition at line 771 of file lamakan_desert.c.

Referenced by MeetSandMonster().

◆ LamakanDesert_Initialize()

s32 LamakanDesert_Initialize ( s32 a0,
s32 a1 )

Entering the desert: the heat gauge (600 steps) starts on the first three maps, the patches Reveal uncovers are saved to the spare cells at 64, 126 or 64, 124, and the secrets are hidden.

Definition at line 835 of file lamakan_desert.c.

Referenced by LamakanDesert_Initialize().

◆ SandMonster_Return()

UNUSED void SandMonster_Return ( void )
static

The monster sinks back to its spot; nothing calls this.

Definition at line 881 of file lamakan_desert.c.

Referenced by SandMonster_Return().

◆ HeatGauge_Draw()

void HeatGauge_Draw ( void )
static

Every frame: draws the heat gauge.

It sits 8 pixels lower while held, slides away while flag 0x104 is set, its bar shrinks as the heat grows, and its colors turn redder (flickering greener past 60 of 120).

Definition at line 891 of file lamakan_desert.c.

Referenced by HeatGauge_Draw(), and HeatGauge_Start().

◆ HeatGauge_Start()

void HeatGauge_Start ( void )

Loads the gauge's tiles, claims VRAM for them and starts drawing it.

Definition at line 1044 of file lamakan_desert.c.

Referenced by HeatGauge_Start(), and LamakanDesert_Initialize().

Variable Documentation

◆ gEffectScript0

const s32 gEffectScript0[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(22, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}
#define SC_LOOP(n, to)
Repeat up to n times.
Definition objcmd.h:28
#define SC_POS(x, y, z)
Set position.
Definition objcmd.h:18
#define SC_FREE
Release.
Definition objcmd.h:43
#define SC_WAIT(n)
Wait n frames.
Definition objcmd.h:16
#define SC_TOP
Script start.
Definition objcmd.h:13

Definition at line 1064 of file lamakan_desert.c.

◆ gEffectScript1

const s32 gEffectScript1[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(44, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}

Definition at line 1069 of file lamakan_desert.c.

◆ gEffectScript2

const s32 gEffectScript2[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(126, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}

Definition at line 1074 of file lamakan_desert.c.

◆ gLamakanDesertRecoveryPoints1

const s32 gLamakanDesertRecoveryPoints1[]
Initial value:
= {
PIXELS(384), PIXELS(128),
PIXELS(288), PIXELS(688),
PIXELS(608), PIXELS(720),
}
#define PIXELS(value)

Each map's recovery points, as x, z pairs.

Definition at line 1081 of file lamakan_desert.c.

Referenced by CollapseFromHeat().

◆ gLamakanDesertRecoveryPoints2

const s32 gLamakanDesertRecoveryPoints2[]
Initial value:
= {
PIXELS(704), PIXELS(96),
PIXELS(448), PIXELS(464),
PIXELS(832), PIXELS(592),
PIXELS(128), PIXELS(752),
PIXELS(464), PIXELS(896),
}

Definition at line 1087 of file lamakan_desert.c.

Referenced by CollapseFromHeat().

◆ gLamakanDesertRecoveryPointsOther

const s32 gLamakanDesertRecoveryPointsOther[]
Initial value:
= {
PIXELS(192), PIXELS(224),
PIXELS(192), PIXELS(352),
}

Definition at line 1095 of file lamakan_desert.c.

Referenced by CollapseFromHeat().

◆ gEffectScripts

const s32* gEffectScripts[]
Initial value:
= {
}
s32 gEffectScript0[]
s32 gEffectScript1[]
s32 gEffectScript2[]

Definition at line 1100 of file lamakan_desert.c.

◆ gLamakanDesertEntrancesOther

struct SceneEntrance gLamakanDesertEntrancesOther[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 256, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 256, 0, 100, FACING_SOUTH, 0, 0, 0, 0, 0, 0 },
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_SOUTH
Definition field_scene.h:28

Definition at line 1106 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ gLamakanDesertEntrances1

struct SceneEntrance gLamakanDesertEntrances1[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 256, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 984, 0, 952, FACING_WEST, 0, 0, 0, 1016, 1016, 0 },
{ 2, CONDITION_ALWAYS, 400, 0, 24, FACING_SOUTH, 0, 0, 0, 1016, 1016, 0 },
}
@ FACING_WEST
Definition field_scene.h:30

Definition at line 1112 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ gLamakanDesertEntrances2

struct SceneEntrance gLamakanDesertEntrances2[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 256, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 912, 0, 1000, FACING_NORTH, 0, 0, 0, 1016, 1016, 0 },
{ 2, CONDITION_ALWAYS, 24, 0, 584, FACING_EAST, 0, 0, 0, 1016, 1016, 0 },
}
@ FACING_EAST
Definition field_scene.h:26
@ FACING_NORTH
Definition field_scene.h:32

Definition at line 1119 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ gLamakanDesertEntrances3

struct SceneEntrance gLamakanDesertEntrances3[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 256, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 1511, 0, 104, FACING_WEST, 0, 0, 8, 1528, 504, 0 },
{ 2, CONDITION_ALWAYS, 727, 0, 104, FACING_SOUTH, 0, 0, 8, 1528, 504, 0 },
{ 3, CONDITION_ALWAYS, 599, 0, 296, FACING_SOUTH, 0, 0, 8, 1528, 504, 0 },
{ 4, CONDITION_ALWAYS, 167, 0, 120, FACING_SOUTH, 0, 0, 8, 1528, 504, 0 },
{ 5, CONDITION_ALWAYS, 167, 0, 136, FACING_NORTH, 0, 0, 8, 1528, 504, 0 },
}

Definition at line 1126 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ gLamakanDesertEntrances4

struct SceneEntrance gLamakanDesertEntrances4[]
Initial value:
= {
{ 0, CONDITION_ALWAYS, 424, 0, 824, FACING_WEST, 0, -1, -1, -1, -1, 0 },
{ 1, CONDITION_ALWAYS, 424, 0, 968, FACING_NORTH, 0, 304, 560, 624, 1024, 0 },
{ 2, CONDITION_ALWAYS, 552, 0, 776, FACING_NORTH, 0, 304, 560, 624, 1024, 0 },
{ 3, CONDITION_ALWAYS, 440, 0, 312, FACING_NORTH, 0, 32, 16, 496, 320, 0 },
{ 4, CONDITION_ALWAYS, 136, 0, 296, FACING_NORTH, 0, 32, 16, 496, 320, 0 },
}

Definition at line 1136 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEntrances().

◆ gLamakanDesertExits

u32 gLamakanDesertExits[]
Initial value:
= {
SCENE_EXIT(1, 2, 18),
SCENE_EXIT(2, 90, 1),
SCENE_EXIT(0, 90, 0),
SCENE_EXIT(1, 89, 2),
SCENE_EXIT(2, 91, 1),
SCENE_EXIT(0, 91, 0),
SCENE_EXIT(1, 90, 2),
SCENE_EXIT(2, 92, 2),
SCENE_EXIT(3, 92, 1),
SCENE_EXIT(4, 92, 3),
SCENE_EXIT(0, 92, 0),
SCENE_EXIT(1, 91, 2),
SCENE_EXIT(2, 91, 3),
SCENE_EXIT(3, 2, 53),
SCENE_EXIT(4, 91, 4),
}
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
#define SCENE_EXITS_END
Definition field_scene.h:77

Definition at line 1145 of file lamakan_desert.c.

Referenced by LamakanDesert_GetExits().

◆ gLamakanDesertPlacementsOther

struct ScenePlacement gLamakanDesertPlacementsOther[]
Initial value:
= {
}

Definition at line 1165 of file lamakan_desert.c.

Referenced by LamakanDesert_GetPlacements().

◆ gLamakanDesertPlacements1

struct ScenePlacement gLamakanDesertPlacements1[]
Initial value:
= {
PIXELS(400), 0, PIXELS(364), FACING_SOUTH, TALK_FACE_PARTY, 0 },
}
@ TALK_FACE_PARTY
@ ACTOR_STAND
#define FLAG_LAMAKAN_SAND_MONSTER_BEATEN
on the third map
Definition flags.h:268

Definition at line 1169 of file lamakan_desert.c.

Referenced by LamakanDesert_GetPlacements().

◆ gLamakanDesertPlacements2

struct ScenePlacement gLamakanDesertPlacements2[]

◆ gLamakanDesertPlacements3

struct ScenePlacement gLamakanDesertPlacements3[]
Initial value:

Definition at line 1193 of file lamakan_desert.c.

Referenced by LamakanDesert_GetPlacements().

◆ gLamakanDesertEvents

struct SceneEvent gLamakanDesertEvents[]

Definition at line 1201 of file lamakan_desert.c.

Referenced by LamakanDesert_GetEvents().

◆ gHeatGaugeLevel

s16 gHeatGaugeLevel = 0

The gauge: how full it is (0 to 120), how far it has slid onto the screen, and a flash as it fills.

Definition at line 1244 of file lamakan_desert.c.

Referenced by HeatGauge_Draw().

◆ gHeatGaugeSlide

s16 gHeatGaugeSlide = 0

Definition at line 1246 of file lamakan_desert.c.

Referenced by HeatGauge_Draw(), and HeatGauge_Start().

◆ gHeatGaugeFlash

s16 gHeatGaugeFlash = 0

Definition at line 1248 of file lamakan_desert.c.

Referenced by HeatGauge_Draw().