summaryrefslogtreecommitdiff
path: root/Add-a-new-scene-script.md
blob: bb1399b484979e4c3bb7979193572ec060ce22c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
This tutorial is for adding a scene event to a map. We'll be Using Azalea Gym as an example.


## Contents

1. [Define SceneID in WRAM](#1-define-sceneid-in-wram)
2. [Define scene_var](#2-define-scene_var)
3. [Define the Scene](#3-define-the-scene)
4. [Add the Scene to Azalea Gym](#4-add-the-scene-to-azalea-gym)


## 1. Define SceneID in WRAM

Azalea Town Doesn't have a SceneID yet, so we need to define it. Edit [wram.asm](../blob/master/wram.asm):

```diff
INCLUDE "constants.asm"

INCLUDE "macros/wram.asm"
...
wMobileTradeRoomSceneID::                         db ; d9bf
wMobileBattleRoomSceneID::                        db ; d9c0
+wAzaleaGymSceneID::                              db ; d9c1

-	ds 49
+       ds 48

```
If you add more Scene Ids in the future you'll have to decrement the number after `ds` accordingly


## 2. Define scene_var

Edit [data/maps/scenes.asm](../blob/master/data/maps/scenes.asm):

```diff
scene_var: MACRO
; map, variable
...
	scene_var MOBILE_BATTLE_ROOM,                          wMobileBattleRoomSceneID
+	scene_var AZALEA_GYM,                                  wAzaleaGymSceneID
	db -1 ; end

```


## 3. Define the scene

Edit [constants/scene_constants.asm](../blob/master/constants/scene_constants.asm):

```diff
; See data/maps/scenes.asm for which maps have scene variables.
; Each scene_script and coord_event is associated with a current scene ID.
...
; wFastShip1FSceneID
	const_def 1
	const SCENE_FASTSHIP1F_ENTER_SHIP   ; 1
	const SCENE_FASTSHIP1F_MEET_GRANDPA ; 2

+; wAzaleaGymSceneID
+	const_def 
+	const SCENE_AZALEAGYM_NOTHING
+	const SCENE_AZALEAGYM_SCENE
```


## 4. Add the Scene to Azalea Gym

Edit [maps/AzaleaGym.asm](../blob/master/maps/AzaleaGym.asm):

```diff
	object_const_def ; object_event constants
	const AZALEAGYM_BUGSY
...
AzaleaGym_MapScripts:
	def_scene_scripts
+	scene_script .DummyScene0 ; SCENE_AZALEAGYM_NOTHING
+	scene_script .DummyScene1 ; SCENE_AZALEAGYM_SCENE

	def_callbacks

+.DummyScene0
+.DummyScene1
+       end
```

(Before August 2020, maps did not have `def_*` macros, so they had to manually declare their quantities of `scene_script`s, `callback`s, etc. So instead of `def_scene_scripts` they used to have `db 0 ; scene scripts`, which you would change here to `db 2`.)

That's it! Now you can use these scenes for a Coord event.