Partial Safari Game implementation

This adds some infrastructure for the Safari Game, specifically;
- The guards who let you in; the ticket is given and Safari Balls are provided; you also get the leaving early and so on. Bit janky at times.
- Infrastructure for the step system, albeit unfinished; the steps aren't initially counted and there's no kicking out process yet.

All in all, it's now playable, but the loss conditions are not yet finished. I shall now lay down in a dark room.
This commit is contained in:
Llinos Evans 2024-07-29 18:42:40 +01:00
parent b64504b9fd
commit 76c497dd99
9 changed files with 288 additions and 6 deletions

View file

@ -94,6 +94,7 @@ If you use our implementations of anything at all, it is encouraged to submit Pu
- Zeta_Null (Repository Owner, Spriter, Programming) - Zeta_Null (Repository Owner, Spriter, Programming)
- LadyMisticus (Documentation, Programming, Mapping) - LadyMisticus (Documentation, Programming, Mapping)
- thornAvery (Programming) - thornAvery (Programming)
- LuciShrimp (Music, TBA)
- pret et al (LOTS of [Tutorials](https://github.com/pret/pokecrystal/wiki) that we used to get this off the ground!) - pret et al (LOTS of [Tutorials](https://github.com/pret/pokecrystal/wiki) that we used to get this off the ground!)
- Wiz (Nihon Pokemon names) - Wiz (Nihon Pokemon names)
- Rezzo (GSC-specific advice, Showdown Mod assistance) - Rezzo (GSC-specific advice, Showdown Mod assistance)

View file

@ -1548,7 +1548,8 @@
const EVENT_GONE_THROUGH_STARTER_DOOR const EVENT_GONE_THROUGH_STARTER_DOOR
const EVENT_BRIEFED_BY_BLUE const EVENT_BRIEFED_BY_BLUE
const EVENT_GOT_TM47_STEEL_WING2 const EVENT_GOT_TM47_STEEL_WING2
; Unused: next 39 events const EVENT_IN_SAFARI_ZONE
; Unused: next 37 events
const_next 2048 const_next 2048
DEF NUM_EVENTS EQU const_value ; 800 DEF NUM_EVENTS EQU const_value ; 800

View file

@ -176,7 +176,7 @@ MapGroup_Dungeons:
map UndergroundPath, TILESET_UNDERGROUND, GATE, LANDMARK_UNDERGROUND_PATH, MUSIC_MT_MOON, FALSE, PALETTE_NITE, FISHGROUP_SHORE map UndergroundPath, TILESET_UNDERGROUND, GATE, LANDMARK_UNDERGROUND_PATH, MUSIC_MT_MOON, FALSE, PALETTE_NITE, FISHGROUP_SHORE
map RockTunnel1F, TILESET_DARK_CAVE, CAVE, LANDMARK_ROCK_TUNNEL, MUSIC_MT_MOON, TRUE, PALETTE_DARK, FISHGROUP_SHORE map RockTunnel1F, TILESET_DARK_CAVE, CAVE, LANDMARK_ROCK_TUNNEL, MUSIC_MT_MOON, TRUE, PALETTE_DARK, FISHGROUP_SHORE
map RockTunnelB1F, TILESET_DARK_CAVE, CAVE, LANDMARK_ROCK_TUNNEL, MUSIC_MT_MOON, TRUE, PALETTE_DARK, FISHGROUP_SHORE map RockTunnelB1F, TILESET_DARK_CAVE, CAVE, LANDMARK_ROCK_TUNNEL, MUSIC_MT_MOON, TRUE, PALETTE_DARK, FISHGROUP_SHORE
map SafariZoneFuchsiaGateBeta, TILESET_GATE, INDOOR, LANDMARK_KANTO_SAFARI_ZONE, MUSIC_VIRIDIAN_CITY, FALSE, PALETTE_DAY, FISHGROUP_SHORE map SafariZoneFuchsiaGateBeta, TILESET_GATE, INDOOR, LANDMARK_FUCHSIA_CITY, MUSIC_VIRIDIAN_CITY, FALSE, PALETTE_DAY, FISHGROUP_SHORE
map SafariZoneBeta, TILESET_PARK, CAVE, LANDMARK_KANTO_SAFARI_ZONE, MUSIC_EVOLUTION, FALSE, PALETTE_AUTO, FISHGROUP_SHORE map SafariZoneBeta, TILESET_PARK, CAVE, LANDMARK_KANTO_SAFARI_ZONE, MUSIC_EVOLUTION, FALSE, PALETTE_AUTO, FISHGROUP_SHORE
map VictoryRoad, TILESET_CAVE, CAVE, LANDMARK_VICTORY_ROAD, MUSIC_VICTORY_ROAD, TRUE, PALETTE_NITE, FISHGROUP_SHORE map VictoryRoad, TILESET_CAVE, CAVE, LANDMARK_VICTORY_ROAD, MUSIC_VICTORY_ROAD, TRUE, PALETTE_NITE, FISHGROUP_SHORE
assert_table_length NUM_DUNGEONS_MAPS assert_table_length NUM_DUNGEONS_MAPS

View file

@ -89,4 +89,5 @@ MapScenes::
scene_var SILENT_HILLS, wSilentHillsSceneID scene_var SILENT_HILLS, wSilentHillsSceneID
scene_var BLUE_LAB, wBlueLabSceneID scene_var BLUE_LAB, wBlueLabSceneID
scene_var ROUTE_66_WHITE_CITY_GATE, wRoute66WhiteCityGateID scene_var ROUTE_66_WHITE_CITY_GATE, wRoute66WhiteCityGateID
scene_var SAFARI_ZONE_FUCHSIA_GATE_BETA, wFuchsiaSafariZoneGateID
db -1 ; end db -1 ; end

View file

@ -881,6 +881,8 @@ CountStep:
call DoRepelStep call DoRepelStep
jr c, .doscript jr c, .doscript
call DoSafariStep
; Count the step for poison and total steps ; Count the step for poison and total steps
ld hl, wPoisonStepCount ld hl, wPoisonStepCount
inc [hl] inc [hl]
@ -953,6 +955,33 @@ DoRepelStep:
scf scf
ret ret
; It's basically the same as the Repel, so we can do that.
DoSafariStep:
; Firstly, check the player is within the landmark.
; Even the gates of the Safari Zone do not have the landmark. This is to ensure the steps and wild encounters are always part of the game.
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
call GetWorldMapLocation
cp LANDMARK_KANTO_SAFARI_ZONE ; I am 99.9% sure this can be done better
jr nz, .skip
; cp LANDMARK_JOHTO_SAFARI_ZONE enable these when they're up pls
; jr nz, .skip
; cp LANDMARK_NIHON_SAFARI_ZONE
; jr nz, .skip
ld a, [wSafariZoneStepCount]
and a
ret z
dec a
ld [wSafariZoneStepCount], a
ret nz
.skip
ret ; juuuuust to make sure, but also part of the safari step check.
DoPlayerEvent: DoPlayerEvent:
ld a, [wScriptRunning] ld a, [wScriptRunning]
and a and a

View file

@ -377,7 +377,7 @@ DebugRoom_MapEvents:
warp_event 5, 9, PALLET_TOWN, 1 ; right lab/league warp warp_event 5, 9, PALLET_TOWN, 1 ; right lab/league warp
warp_event 35, 17, OLD_CITY, 1 ; east warp warp_event 35, 17, OLD_CITY, 1 ; east warp
warp_event 5, 35, LAVENDER_TOWN, 1 ; southwest warp warp_event 5, 35, LAVENDER_TOWN, 1 ; southwest warp
warp_event 19, 34, SAFARI_ZONE_BETA, 1 ; southern warp warp_event 19, 34, SAFARI_ZONE_FUCHSIA_GATE_BETA, 3 ; southern warp
warp_event 33, 33, BLUE_FOREST, 1 ; southeast warp warp_event 33, 33, BLUE_FOREST, 1 ; southeast warp
warp_event 5, 3, AZALEA_TOWN, 1 warp_event 5, 3, AZALEA_TOWN, 1
warp_event 34, 11, WINNERS_PATH, 3 warp_event 34, 11, WINNERS_PATH, 3

View file

@ -3,6 +3,31 @@ SafariZoneBeta_MapScripts:
def_callbacks def_callbacks
SafariZoneCheckSteps:
ld a, [wSafariZoneStepCount] ; check if you have more than 0 steps.
jr nz, .skip ; if not zero, ignore. easy enough.
checkitem SAFARI_BALL ; check if the player has any safari balls left
iftrue .skip ; this checks if there's any at all, so same principle.
playsound SFX_ELEVATOR_END
opentext
writetext SafariZoneTimesUpText
waitbutton
closetext
warpfacing UP, SAFARI_ZONE_FUCHSIA_GATE_BETA, 4, 0
.skip
ret
SafariZoneTimesUpText:
text "PA: Ding-dong!"
para "Time's up!"
para "Your SAFARI GAME"
line "is over!"
done
SafariZoneBeta_MapEvents: SafariZoneBeta_MapEvents:
db 0, 0 ; filler db 0, 0 ; filler

View file

@ -2,6 +2,220 @@ SafariZoneFuchsiaGateBeta_MapScripts:
def_scene_scripts def_scene_scripts
def_callbacks def_callbacks
scene_const SCENE_SAFARI_ZONE
SafariZoneEntry:
opentext
checkevent EVENT_IN_SAFARI_ZONE
iftrue .exiting
special PlaceMoneyTopRight
writetext SafariZoneEntranceText1
yesorno
iffalse .refused
checkmoney YOUR_MONEY, 500
ifequal HAVE_LESS, .cantafford
takemoney YOUR_MONEY, 500
waitsfx
playsound SFX_TRANSACTION
closetext
opentext
writetext SafariZoneEntranceText2
waitbutton
closetext
opentext
verbosegiveitem SAFARI_BALL, 30
opentext
writetext SafariZoneEntranceText3
waitbutton
closetext
applymovement PLAYER, SafariZoneEntryMovement
warpfacing UP, SAFARI_ZONE_BETA, 9, 23
playsound SFX_ENTER_DOOR
setevent EVENT_IN_SAFARI_ZONE
; Give the player 500 steps...I think.
;ld a, 250
;ld a, 10 ; just to test the PA.
;ld [wSafariZoneStepCount], a
;ld [wSafariZoneStepCount+1], a
;xor a
sjump .done
.cantafford
opentext
writetext SafariZoneNoMoneyText
waitbutton
closetext
sjump .refuseEntry
.refused
opentext
writetext SafariZoneExitText
waitbutton
closetext
; fallthrough
.refuseEntry
applymovement PLAYER, SafariZoneRefuseEntryMovement
sjump .done
.exiting
checkevent EVENT_IN_SAFARI_ZONE
iffalse .skip
opentext
writetext SafariZoneLeavingEarlyText
yesorno
iftrue .leavingEarly
opentext
writetext SafariZoneNoLeaveEarlyText
waitbutton
closetext
applymovement PLAYER, SafariZoneNoLeaveEarlyMovement
warpfacing UP, SAFARI_ZONE_BETA, 9, 23
playsound SFX_ENTER_DOOR
jr .done
.leavingEarly
writetext SafariZoneReturnTheBallsText
waitbutton
closetext
takeitem SAFARI_BALL, 30
; fallthrough
.skip
applymovement PLAYER, MuseumLeaveNaturallyMovement
opentext
writetext SafariZoneExitText
waitbutton
closetext
clearevent EVENT_IN_SAFARI_ZONE
.done
end
SafariZoneEntranceText1:
text "Welcome to the"
line "SAFARI ZONE!"
para "For just ¥500,"
line "you can catch all"
cont "the #MON you"
cont "want in the park!"
para "Would you like to"
line "join the hunt?"
done
SafariZoneEntranceText2:
text "That'll be ¥500"
line "please!"
para "We only use a"
line "special # BALL"
cont "here."
done
SafariZoneEntranceText3:
text "We'll call you on"
line "the PA when you"
cont "run out of time"
cont "or SAFARI BALLs!"
done
SafariZoneExitText:
text "OK! Please come"
line "again!"
done
SafariZoneNoMoneyText:
text "Oops! Not enough"
line "money!"
done
SafariZoneLeavingEarlyText:
text "Leaving early?"
done
SafariZoneReturnTheBallsText:
text "Please return any"
line "SAFARI BALLs you"
cont "have left."
done
SafariZoneNoLeaveEarlyText:
text "Good luck!"
done
SafariZoneLeftNaturallyText:
text "Did you get a"
line "good haul?"
cont "Come again!"
done
SafariZoneFirstTimeText:
text "Hi! Is it your"
line "first time here?"
done
SafariZoneExplanationText:
text "SAFARI ZONE has 4"
line "zones in it."
para "Each zone has"
line "different kinds"
cont "of #MON. Use"
cont "SAFARI BALLs to"
cont "catch them!"
para "When you run out"
line "of time or SAFARI"
cont "BALLs, it's game"
cont "over for you!"
para "Before you go,"
line "open an unused"
cont "#MON BOX so"
cont "there's room for"
cont "new #MON!"
done
SafariZoneNoNeedText:
text "Sorry, you're a"
line "regular here!"
done
SafariZoneEntryMovement:
step UP
step UP
step UP
step_end
SafariZoneNoLeaveEarlyMovement:
step UP
step_end
SafariZoneRefuseEntryMovement:
step DOWN
step_end
MuseumLeaveNaturallyMovement:
step DOWN
step DOWN
step DOWN
step DOWN
step_end
SafariZoneHelper:
faceplayer
opentext
writetext SafariZoneFirstTimeText
waitbutton
yesorno
iffalse .skip
writetext SafariZoneExplanationText
sjump .done
.skip
writetext SafariZoneNoNeedText
.done
waitbutton
closetext
end
SafariZoneFuchsiaGateBeta_MapEvents: SafariZoneFuchsiaGateBeta_MapEvents:
db 0, 0 ; filler db 0, 0 ; filler
@ -13,7 +227,17 @@ SafariZoneFuchsiaGateBeta_MapEvents:
warp_event 5, 7, FUCHSIA_CITY, 7 warp_event 5, 7, FUCHSIA_CITY, 7
def_coord_events def_coord_events
coord_event 5, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 2, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 4, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 5, 1, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 3, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 4, 1, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 6, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
coord_event 7, 3, SCENE_SAFARI_ZONE, SafariZoneEntry
def_bg_events def_bg_events
def_object_events def_object_events
object_event 0, 3, SPRITE_SAFARI_ZONE_WORKER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1
object_event 9, 4, SPRITE_SAFARI_ZONE_WORKER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, SafariZoneHelper, -1

View file

@ -3110,7 +3110,8 @@ wPewterMuseum1FSceneID:: db
wSilentHillsSceneID:: db wSilentHillsSceneID:: db
wBlueLabSceneID:: db wBlueLabSceneID:: db
wRoute66WhiteCityGateID:: db wRoute66WhiteCityGateID:: db
ds 45 wFuchsiaSafariZoneGateID:: db
ds 44
; fight counts ; fight counts
wJackFightCount:: db wJackFightCount:: db
@ -3251,7 +3252,7 @@ wStepCount:: db
wPoisonStepCount:: db wPoisonStepCount:: db
ds 2 ds 2
wHappinessStepCount:: db wHappinessStepCount:: db
ds 1 wSafariZoneStepCount:: dw ; Will contain 500 steps
wParkBallsRemaining:: wParkBallsRemaining::
wSafariBallsRemaining:: db wSafariBallsRemaining:: db
@ -3259,7 +3260,7 @@ wSafariTimeRemaining:: dw
wPhoneList:: ds CONTACT_LIST_SIZE + 1 wPhoneList:: ds CONTACT_LIST_SIZE + 1
ds 22 ds 21
wLuckyNumberShowFlag:: db wLuckyNumberShowFlag:: db
ds 1 ds 1