mirror of
				https://github.com/thornAvery/jep-hack.git
				synced 2025-11-04 21:01:01 +13:00 
			
		
		
		
	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:
		
							parent
							
								
									b64504b9fd
								
							
						
					
					
						commit
						76c497dd99
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
- LadyMisticus (Documentation, Programming, Mapping)
 | 
			
		||||
- 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!)
 | 
			
		||||
- Wiz (Nihon Pokemon names)
 | 
			
		||||
- Rezzo (GSC-specific advice, Showdown Mod assistance)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1548,7 +1548,8 @@
 | 
			
		|||
	const EVENT_GONE_THROUGH_STARTER_DOOR
 | 
			
		||||
	const EVENT_BRIEFED_BY_BLUE
 | 
			
		||||
	const EVENT_GOT_TM47_STEEL_WING2
 | 
			
		||||
; Unused: next 39 events
 | 
			
		||||
	const EVENT_IN_SAFARI_ZONE
 | 
			
		||||
; Unused: next 37 events
 | 
			
		||||
 | 
			
		||||
	const_next 2048
 | 
			
		||||
DEF NUM_EVENTS EQU const_value ; 800
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,7 +176,7 @@ MapGroup_Dungeons:
 | 
			
		|||
	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 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 VictoryRoad, TILESET_CAVE, CAVE, LANDMARK_VICTORY_ROAD, MUSIC_VICTORY_ROAD, TRUE, PALETTE_NITE, FISHGROUP_SHORE
 | 
			
		||||
	assert_table_length NUM_DUNGEONS_MAPS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,4 +89,5 @@ MapScenes::
 | 
			
		|||
	scene_var SILENT_HILLS,					   		       wSilentHillsSceneID
 | 
			
		||||
	scene_var BLUE_LAB,									   wBlueLabSceneID
 | 
			
		||||
	scene_var ROUTE_66_WHITE_CITY_GATE, wRoute66WhiteCityGateID
 | 
			
		||||
	scene_var SAFARI_ZONE_FUCHSIA_GATE_BETA, wFuchsiaSafariZoneGateID
 | 
			
		||||
	db -1 ; end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -880,6 +880,8 @@ CountStep:
 | 
			
		|||
	; If Repel wore off, don't count the step.
 | 
			
		||||
	call DoRepelStep
 | 
			
		||||
	jr c, .doscript
 | 
			
		||||
	
 | 
			
		||||
	call DoSafariStep
 | 
			
		||||
 | 
			
		||||
	; Count the step for poison and total steps
 | 
			
		||||
	ld hl, wPoisonStepCount
 | 
			
		||||
| 
						 | 
				
			
			@ -953,6 +955,33 @@ DoRepelStep:
 | 
			
		|||
	scf
 | 
			
		||||
	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:
 | 
			
		||||
	ld a, [wScriptRunning]
 | 
			
		||||
	and a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -377,7 +377,7 @@ DebugRoom_MapEvents:
 | 
			
		|||
	warp_event  5,  9, PALLET_TOWN, 1 ; right lab/league warp
 | 
			
		||||
	warp_event 35, 17, OLD_CITY, 1 ; east 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  5,  3, AZALEA_TOWN, 1
 | 
			
		||||
	warp_event 34, 11, WINNERS_PATH, 3
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,31 @@ SafariZoneBeta_MapScripts:
 | 
			
		|||
 | 
			
		||||
	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:
 | 
			
		||||
	db 0, 0 ; filler
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,220 @@ SafariZoneFuchsiaGateBeta_MapScripts:
 | 
			
		|||
	def_scene_scripts
 | 
			
		||||
 | 
			
		||||
	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:
 | 
			
		||||
	db 0, 0 ; filler
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +227,17 @@ SafariZoneFuchsiaGateBeta_MapEvents:
 | 
			
		|||
	warp_event  5,  7, FUCHSIA_CITY, 7
 | 
			
		||||
 | 
			
		||||
	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_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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3110,7 +3110,8 @@ wPewterMuseum1FSceneID::						  db
 | 
			
		|||
wSilentHillsSceneID::							  db
 | 
			
		||||
wBlueLabSceneID::								  db
 | 
			
		||||
wRoute66WhiteCityGateID:: db
 | 
			
		||||
	ds 45
 | 
			
		||||
wFuchsiaSafariZoneGateID:: db
 | 
			
		||||
	ds 44
 | 
			
		||||
 | 
			
		||||
; fight counts
 | 
			
		||||
wJackFightCount::    db
 | 
			
		||||
| 
						 | 
				
			
			@ -3251,7 +3252,7 @@ wStepCount:: db
 | 
			
		|||
wPoisonStepCount:: db
 | 
			
		||||
	ds 2
 | 
			
		||||
wHappinessStepCount:: db
 | 
			
		||||
	ds 1
 | 
			
		||||
wSafariZoneStepCount:: dw ; Will contain 500 steps
 | 
			
		||||
 | 
			
		||||
wParkBallsRemaining::
 | 
			
		||||
wSafariBallsRemaining:: db
 | 
			
		||||
| 
						 | 
				
			
			@ -3259,7 +3260,7 @@ wSafariTimeRemaining:: dw
 | 
			
		|||
 | 
			
		||||
wPhoneList:: ds CONTACT_LIST_SIZE + 1
 | 
			
		||||
 | 
			
		||||
	ds 22
 | 
			
		||||
	ds 21
 | 
			
		||||
 | 
			
		||||
wLuckyNumberShowFlag:: db
 | 
			
		||||
	ds 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue