Browse Source

text system, some images, some section fixes

05117n complete
SBird1337 7 years ago
parent
commit
f62e2aaabf
39 changed files with 4475 additions and 194 deletions
  1. BIN
      assets/interface/arrows.png
  2. BIN
      assets/interface/emoticons.png
  3. 14
    0
      bpre.sym
  4. 1
    1
      data/item/item_gfx.S
  5. 1
    1
      data/item/item_scripts.S
  6. 1
    1
      data/overworld/overworld_data.S
  7. 1
    1
      data/overworld/overworld_frames.S
  8. 1
    1
      data/overworld/overworld_pal_table.S
  9. 1
    1
      data/raw_defines.s
  10. 43
    116
      data/text_lookup/text_lookup_array.s
  11. 32
    0
      data/text_lookup/text_lookup_trainer.s
  12. 1
    1
      data/text_lookup/text_multichoice.s
  13. 256
    0
      data/trainer_sprites/ts_alt.s
  14. 1029
    0
      data/trainer_sprites/ts_pal.s
  15. 1030
    0
      data/trainer_sprites/ts_tiles.s
  16. 2
    0
      gfx_build/trainer_sprites/.gitignore
  17. 5
    0
      main.asm
  18. 56
    3
      nbproject/configurations.xml
  19. 1398
    4
      nbproject/private/configurations.xml
  20. 6
    37
      nbproject/private/private.xml
  21. 12
    12
      patches/dns/core.asm
  22. 2
    2
      patches/special.asm
  23. 4
    1
      patches/text_system.asm
  24. 11
    0
      patches/trainer_sprites/altitude.asm
  25. 60
    0
      patches/trainer_sprites/images.asm
  26. 12
    1
      sprites.makefile
  27. 1
    1
      src/include/assets/interface/arrows.img.h
  28. BIN
      src/include/assets/interface/emoticons.img.bin
  29. 1
    1
      src/include/assets/interface/emoticons.img.h
  30. 0
    1
      src/specials/custom_specials.c
  31. 151
    3
      src/specials/load_text_special.c
  32. 311
    0
      src/specials/trainer_battle.c
  33. 1
    0
      string/de/invalid.txt
  34. 25
    0
      string/de/story_text/hesperia/globals.txt
  35. 1
    0
      string/de/story_text/hesperia/player_house.txt
  36. 0
    1
      string/de/story_text/tundra_hq/globals.txt
  37. 0
    3
      string/de/text.txt
  38. 2
    0
      string/de/trainers/test_trainers.txt
  39. 3
    1
      string/table.tbl

BIN
assets/interface/arrows.png View File


BIN
assets/interface/emoticons.png View File


+ 14
- 0
bpre.sym View File

@@ -139,6 +139,20 @@ side_affecting_halfword = 0x2023DDE;
139 139
 battle_turn_order = 0x02023bde;
140 140
 battle_status_3 = 0x02023DFC;
141 141
 
142
+battle_80801F0_something = 0x080801F0|1;
143
+battle_init = 0x08080110|1;
144
+
145
+trainerbattle_battle_type = 0x020386AC;
146
+trainerbattle_flag_id = 0x020386AE;
147
+trainerbattle_arg2 = 0x020386B0;
148
+trainerbattle_message_intro = 0x020386B4;
149
+trainerbattle_message_defeat = 0x020386B8;
150
+trainerbattle_message_2 = 0x020386BC;
151
+trainerbattle_message_need_2_poke = 0x020386C0;
152
+trainerbattle_next_scr_cmd = 0x020386C4;
153
+trainerbattle_message_4 = 0x020386C8;
154
+trainerbattle_unknown = 0x020386CC;
155
+
142 156
 item_get_quality = 0x0809A948|1;
143 157
 item_get_x12 = 0x0809A924|1;
144 158
 

+ 1
- 1
data/item/item_gfx.S View File

@@ -1,5 +1,5 @@
1 1
 #define ITEM_GFX_0	.word 0x08E87028, 0x08E8730C
2
-.section .rodata
2
+.text
3 3
 .align 2
4 4
 .thumb
5 5
 

+ 1
- 1
data/item/item_scripts.S View File

@@ -1,5 +1,5 @@
1 1
 .align 2
2
-
2
+.text 
3 3
 .global item_flagtable
4 4
 item_flagtable:
5 5
 

+ 1
- 1
data/overworld/overworld_data.S View File

@@ -1,5 +1,5 @@
1 1
 .thumb
2
-.section .rodata
2
+.text
3 3
 
4 4
 .global ow_data_0
5 5
 .global ow_data_1

+ 1
- 1
data/overworld/overworld_frames.S View File

@@ -1,5 +1,5 @@
1 1
 .thumb
2
-.section .rodata
2
+.text
3 3
 
4 4
 .global ow_frames_0
5 5
 .global ow_frames_1

+ 1
- 1
data/overworld/overworld_pal_table.S View File

@@ -1,5 +1,5 @@
1 1
 .thumb
2
-.section .rodata
2
+.text
3 3
 .align 2
4 4
 
5 5
 .global ow_pal_table

+ 1
- 1
data/raw_defines.s View File

@@ -1,6 +1,6 @@
1 1
 .align 2
2 2
 .thumb
3
-.section .rodata
3
+.text
4 4
 
5 5
 .global objects
6 6
 objects:

+ 43
- 116
data/text_lookup/text_lookup_array.s View File

@@ -1,99 +1,5 @@
1 1
 .align 2
2 2
 .text
3
-.thumb
4
-
5
-.global get_text_pointer_from_lookup
6
-get_text_pointer_from_lookup:
7
-push {r4-r5, lr}
8
-ldr r0, =str_invalid_text
9
-b valid_text_two
10
-@delete those two lines to activate the system
11
-
12
-ldr r0, =sav_one
13
-ldr r0, [r0]
14
-ldrb r4, [r0, #4] @r4 = bank
15
-ldrb r5, [r0, #5] @r5 = map
16
-ldrh r0, =0x800F
17
-ldr r2, =var_get
18
-bl bxr2 @r0 = person id
19
-ldr r1, =text_lookup_array
20
-lsl r3, r4, #2
21
-add r1, r3
22
-ldr r1, [r1]    @load bank
23
-lsl r3, r5, #2
24
-add r1, r3
25
-ldr r1, [r1]    @load map
26
-add r1, #4      @skip the global map pointer
27
-lsl r3, r0, #2
28
-add r1, r3
29
-ldr r1, [r1]    @load person
30
-mov r4, r1
31
-ldrh r0, =0x500C
32
-ldr r2, =var_get
33
-bl bxr2
34
-lsl r0, #2
35
-add r1, r0, r4
36
-ldr r0, [r1, #0] @load specific ID
37
-lsr r1, r0, #0x18
38
-cmp r1, #8
39
-beq valid_text_two
40
-cmp r1, #9
41
-beq valid_text_two
42
-ldr r0, =str_invalid_text
43
-valid_text_two:
44
-ldr r1, lp_offset
45
-str r0, [r1]
46
-pop {r4-r5}
47
-pop {r1}
48
-bx r1
49
-
50
-.global get_map_pointer_from_lookup
51
-get_map_pointer_from_lookup:
52
-push {r4-r5, lr}
53
-ldr r0, =str_invalid_text
54
-b valid_text_one
55
-@delete those two lines to activate the system
56
-
57
-ldr r0, =sav_one
58
-ldr r0, [r0]
59
-ldrb r4, [r0, #4] @r4 = bank
60
-ldrb r5, [r0, #5] @r5 = map
61
-ldr r1, =text_lookup_array
62
-lsl r3, r4, #2
63
-add r1, r3
64
-ldr r1, [r1]    @load bank
65
-lsl r3, r5, #2
66
-add r1, r3
67
-ldr r1, [r1]    @load map
68
-ldr r4, [r1]    @map specific text array
69
-ldrh r0, =0x500C
70
-ldr r2, =var_get
71
-bl bxr2
72
-lsl r0, #2
73
-add r1, r0, r4
74
-ldr r0, [r1, #0] @load specific ID
75
-lsr r1, r0, #0x18
76
-cmp r1, #8
77
-beq valid_text_one
78
-cmp r1, #9
79
-beq valid_text_one
80
-ldr r0, =str_invalid_text
81
-valid_text_one:
82
-ldr r1, lp_offset
83
-str r0, [r1]
84
-pop {r4-r5}
85
-pop {r1}
86
-bx r1
87
-
88
-bxr2:
89
-bx r2
90
-
91
-.align 2
92
-lp_offset:
93
-    .word 0x03000F14
94
-
95
-.align 2
96
-.section .rodata
97 3
 .global text_lookup_array
98 4
 text_lookup_array:
99 5
     .word text_bank_zero
@@ -105,8 +11,13 @@ text_lookup_array:
105 11
     .word 0xDEADBEEF
106 12
 
107 13
 text_bank_zero:
14
+    .word text_bank_zero_map_zero
15
+    .word 0xDEADBEEF
108 16
 text_bank_one:
109 17
 text_bank_two:
18
+    .word text_bank_two_map_zero
19
+    .word 0xDEADBEEF
20
+
110 21
 text_bank_three:
111 22
 text_bank_four:
112 23
     .word text_bank_zero_map_zero
@@ -117,38 +28,49 @@ text_bank_five:
117 28
     .word 0xDEADBEEF
118 29
 
119 30
 text_bank_zero_map_zero:
120
-text_bank_zero_map_one:
121 31
     .word text_bank_zero_map_zero_global
122
-    .word text_bank_zero_amp_zero_ev_one
123
-    .word text_bank_zero_amp_zero_ev_two
124
-    .word text_bank_zero_amp_zero_ev_three
125
-    .word text_bank_zero_amp_zero_ev_four
126
-    .word text_bank_zero_amp_zero_ev_five
127
-    .word text_bank_zero_amp_zero_ev_six
128
-    .word text_bank_zero_amp_zero_ev_seven
32
+text_bank_zero_map_one:
129 33
     .word 0xDEADBEEF
130 34
 
131
-text_bank_zero_amp_zero_ev_one:
132
-text_bank_zero_amp_zero_ev_two:
133
-text_bank_zero_amp_zero_ev_three:
134
-text_bank_zero_amp_zero_ev_four:
135
-text_bank_zero_amp_zero_ev_five:
136
-text_bank_zero_amp_zero_ev_six:
137
-text_bank_zero_amp_zero_ev_seven:
138
-    .word str_person_test
35
+text_bank_two_map_zero:
36
+    .word text_bank_two_map_zero_global
37
+    .word 0xDEADBEEF
38
+
39
+text_bank_five_map_zero:
40
+    .word text_bank_five_map_zero_global
139 41
     .word 0xDEADBEEF
140 42
 
141 43
 text_bank_zero_map_zero_global:
142
-    .word str_person_test
143
-    .word str_person_zero
44
+    .word str_hesp_out_g_0
45
+    .word str_hesp_out_g_1
46
+    .word str_hesp_out_g_2
47
+    .word str_hesp_out_g_3
48
+    .word str_hesp_out_g_4
49
+    .word str_hesp_out_g_5
50
+    .word str_hesp_out_g_6
51
+    .word str_hesp_out_g_7
52
+    .word str_hesp_out_g_8
53
+    .word str_hesp_out_g_9
54
+    .word str_hesp_out_g_10
55
+    .word str_hesp_out_g_11
56
+    .word str_hesp_out_g_12
57
+    .word str_hesp_out_g_13
58
+    .word str_hesp_out_g_14
59
+    .word str_hesp_out_g_15
60
+    .word str_hesp_out_g_16
61
+    .word str_hesp_out_g_17
62
+    .word str_hesp_out_g_18
63
+    .word str_hesp_out_g_19
64
+    .word str_hesp_out_g_20
65
+    .word str_hesp_out_g_21
66
+    .word str_hesp_out_g_22
144 67
     .word 0xDEADBEEF
145 68
 
146
-text_bank_five_map_zero:
147
-    .word text_bank_five_map_zero_global
69
+text_bank_two_map_zero_global:
70
+    .word str_hesp_20_g_0
148 71
     .word 0xDEADBEEF
149 72
 
150 73
 text_bank_five_map_zero_global:
151
-    .word str_tundra_hq_name
152 74
     .word str_tundra_hq_0
153 75
     .word str_tundra_hq_1
154 76
     .word str_tundra_hq_2
@@ -161,4 +83,9 @@ text_bank_five_map_zero_global:
161 83
     .word str_tundra_hq_9
162 84
     .word str_tundra_hq_10
163 85
     .word str_tundra_hq_11
164
-    .word str_tundra_hq_12
86
+    .word str_tundra_hq_12
87
+    .word 0xDEADBEEF
88
+
89
+.global text_lookup_table
90
+text_lookup_table:
91
+    .word text_lookup_array

+ 32
- 0
data/text_lookup/text_lookup_trainer.s View File

@@ -0,0 +1,32 @@
1
+.align 2
2
+.thumb
3
+.text
4
+
5
+.global trainer_text_table
6
+trainer_text_table:
7
+    .word trainer_texts_0
8
+    .word trainer_texts_1
9
+    .word trainer_texts_2
10
+    .word trainer_texts_3
11
+    .word trainer_texts_4
12
+    .word trainer_texts_5
13
+    .word 0xDEADBEEF
14
+.align 2
15
+
16
+trainer_texts_0:
17
+    .word str_t0_intro
18
+    .word str_t0_defeat
19
+    .word 0xDEADBEEF
20
+trainer_texts_1:
21
+trainer_texts_2:
22
+trainer_texts_3:
23
+trainer_texts_4:
24
+trainer_texts_5:
25
+    .word 0xDEADBEEF
26
+
27
+.align 2
28
+.global trainer_text_array
29
+trainer_text_array:
30
+    .word trainer_text_table
31
+
32
+

+ 1
- 1
data/text_lookup/text_multichoice.s View File

@@ -1,4 +1,4 @@
1
-.section .rodata
1
+.text
2 2
 .align 2
3 3
 
4 4
 .thumb

+ 256
- 0
data/trainer_sprites/ts_alt.s View File

@@ -0,0 +1,256 @@
1
+.hword	0x108, 0
2
+.hword	0x108, 0
3
+.hword	0x108, 0
4
+.hword	0x108, 0
5
+.hword	0x108, 0
6
+.hword	0x108, 0
7
+.hword	0x108, 0
8
+.hword	0x108, 0
9
+.hword	0x108, 0
10
+.hword	0x108, 0
11
+.hword	0x108, 0
12
+.hword	0x108, 0
13
+.hword	0x108, 0
14
+.hword	0x108, 0
15
+.hword	0x108, 0
16
+.hword	0x108, 0
17
+.hword	0x108, 0
18
+.hword	0x108, 0
19
+.hword	0x108, 0
20
+.hword	0x108, 0
21
+.hword	0x108, 0
22
+.hword	0x108, 0
23
+.hword	0x108, 0
24
+.hword	0x108, 0
25
+.hword	0x108, 0
26
+.hword	0x108, 0
27
+.hword	0x108, 0
28
+.hword	0x108, 0
29
+.hword	0x108, 0
30
+.hword	0x108, 0
31
+.hword	0x108, 0
32
+.hword	0x108, 0
33
+.hword	0x108, 0
34
+.hword	0x108, 0
35
+.hword	0x108, 0
36
+.hword	0x108, 0
37
+.hword	0x108, 0
38
+.hword	0x108, 0
39
+.hword	0x108, 0
40
+.hword	0x108, 0
41
+.hword	0x108, 0
42
+.hword	0x108, 0
43
+.hword	0x108, 0
44
+.hword	0x108, 0
45
+.hword	0x108, 0
46
+.hword	0x108, 0
47
+.hword	0x108, 0
48
+.hword	0x108, 0
49
+.hword	0x108, 0
50
+.hword	0x108, 0
51
+.hword	0x108, 0
52
+.hword	0x108, 0
53
+.hword	0x108, 0
54
+.hword	0x108, 0
55
+.hword	0x108, 0
56
+.hword	0x108, 0
57
+.hword	0x108, 0
58
+.hword	0x108, 0
59
+.hword	0x108, 0
60
+.hword	0x108, 0
61
+.hword	0x108, 0
62
+.hword	0x108, 0
63
+.hword	0x108, 0
64
+.hword	0x108, 0
65
+.hword	0x108, 0
66
+.hword	0x108, 0
67
+.hword	0x108, 0
68
+.hword	0x108, 0
69
+.hword	0x108, 0
70
+.hword	0x108, 0
71
+.hword	0x108, 0
72
+.hword	0x108, 0
73
+.hword	0x108, 0
74
+.hword	0x108, 0
75
+.hword	0x108, 0
76
+.hword	0x108, 0
77
+.hword	0x108, 0
78
+.hword	0x108, 0
79
+.hword	0x108, 0
80
+.hword	0x108, 0
81
+.hword	0x108, 0
82
+.hword	0x108, 0
83
+.hword	0x108, 0
84
+.hword	0x108, 0
85
+.hword	0x108, 0
86
+.hword	0x108, 0
87
+.hword	0x108, 0
88
+.hword	0x108, 0
89
+.hword	0x108, 0
90
+.hword	0x108, 0
91
+.hword	0x108, 0
92
+.hword	0x108, 0
93
+.hword	0x108, 0
94
+.hword	0x108, 0
95
+.hword	0x108, 0
96
+.hword	0x108, 0
97
+.hword	0x108, 0
98
+.hword	0x108, 0
99
+.hword	0x108, 0
100
+.hword	0x108, 0
101
+.hword	0x108, 0
102
+.hword	0x108, 0
103
+.hword	0x108, 0
104
+.hword	0x108, 0
105
+.hword	0x108, 0
106
+.hword	0x108, 0
107
+.hword	0x108, 0
108
+.hword	0x108, 0
109
+.hword	0x108, 0
110
+.hword	0x108, 0
111
+.hword	0x108, 0
112
+.hword	0x108, 0
113
+.hword	0x108, 0
114
+.hword	0x108, 0
115
+.hword	0x108, 0
116
+.hword	0x108, 0
117
+.hword	0x108, 0
118
+.hword	0x108, 0
119
+.hword	0x108, 0
120
+.hword	0x108, 0
121
+.hword	0x108, 0
122
+.hword	0x108, 0
123
+.hword	0x108, 0
124
+.hword	0x108, 0
125
+.hword	0x108, 0
126
+.hword	0x108, 0
127
+.hword	0x108, 0
128
+.hword	0x108, 0
129
+.hword	0x108, 0
130
+.hword	0x108, 0
131
+.hword	0x108, 0
132
+.hword	0x108, 0
133
+.hword	0x108, 0
134
+.hword	0x108, 0
135
+.hword	0x108, 0
136
+.hword	0x108, 0
137
+.hword	0x108, 0
138
+.hword	0x108, 0
139
+.hword	0x108, 0
140
+.hword	0x108, 0
141
+.hword	0x108, 0
142
+.hword	0x108, 0
143
+.hword	0x108, 0
144
+.hword	0x108, 0
145
+.hword	0x108, 0
146
+.hword	0x108, 0
147
+.hword	0x108, 0
148
+.hword	0x108, 0
149
+.hword	0x108, 0
150
+.hword	0x108, 0
151
+.hword	0x108, 0
152
+.hword	0x108, 0
153
+.hword	0x108, 0
154
+.hword	0x108, 0
155
+.hword	0x108, 0
156
+.hword	0x108, 0
157
+.hword	0x108, 0
158
+.hword	0x108, 0
159
+.hword	0x108, 0
160
+.hword	0x108, 0
161
+.hword	0x108, 0
162
+.hword	0x108, 0
163
+.hword	0x108, 0
164
+.hword	0x108, 0
165
+.hword	0x108, 0
166
+.hword	0x108, 0
167
+.hword	0x108, 0
168
+.hword	0x108, 0
169
+.hword	0x108, 0
170
+.hword	0x108, 0
171
+.hword	0x108, 0
172
+.hword	0x108, 0
173
+.hword	0x108, 0
174
+.hword	0x108, 0
175
+.hword	0x108, 0
176
+.hword	0x108, 0
177
+.hword	0x108, 0
178
+.hword	0x108, 0
179
+.hword	0x108, 0
180
+.hword	0x108, 0
181
+.hword	0x108, 0
182
+.hword	0x108, 0
183
+.hword	0x108, 0
184
+.hword	0x108, 0
185
+.hword	0x108, 0
186
+.hword	0x108, 0
187
+.hword	0x108, 0
188
+.hword	0x108, 0
189
+.hword	0x108, 0
190
+.hword	0x108, 0
191
+.hword	0x108, 0
192
+.hword	0x108, 0
193
+.hword	0x108, 0
194
+.hword	0x108, 0
195
+.hword	0x108, 0
196
+.hword	0x108, 0
197
+.hword	0x108, 0
198
+.hword	0x108, 0
199
+.hword	0x108, 0
200
+.hword	0x108, 0
201
+.hword	0x108, 0
202
+.hword	0x108, 0
203
+.hword	0x108, 0
204
+.hword	0x108, 0
205
+.hword	0x108, 0
206
+.hword	0x108, 0
207
+.hword	0x108, 0
208
+.hword	0x108, 0
209
+.hword	0x108, 0
210
+.hword	0x108, 0
211
+.hword	0x108, 0
212
+.hword	0x108, 0
213
+.hword	0x108, 0
214
+.hword	0x108, 0
215
+.hword	0x108, 0
216
+.hword	0x108, 0
217
+.hword	0x108, 0
218
+.hword	0x108, 0
219
+.hword	0x108, 0
220
+.hword	0x108, 0
221
+.hword	0x108, 0
222
+.hword	0x108, 0
223
+.hword	0x108, 0
224
+.hword	0x108, 0
225
+.hword	0x108, 0
226
+.hword	0x108, 0
227
+.hword	0x108, 0
228
+.hword	0x108, 0
229
+.hword	0x108, 0
230
+.hword	0x108, 0
231
+.hword	0x108, 0
232
+.hword	0x108, 0
233
+.hword	0x108, 0
234
+.hword	0x108, 0
235
+.hword	0x108, 0
236
+.hword	0x108, 0
237
+.hword	0x108, 0
238
+.hword	0x108, 0
239
+.hword	0x108, 0
240
+.hword	0x108, 0
241
+.hword	0x108, 0
242
+.hword	0x108, 0
243
+.hword	0x108, 0
244
+.hword	0x108, 0
245
+.hword	0x108, 0
246
+.hword	0x108, 0
247
+.hword	0x108, 0
248
+.hword	0x108, 0
249
+.hword	0x108, 0
250
+.hword	0x108, 0
251
+.hword	0x108, 0
252
+.hword	0x108, 0
253
+.hword	0x108, 0
254
+.hword	0x108, 0
255
+.hword	0x108, 0
256
+.hword	0x108, 0

+ 1029
- 0
data/trainer_sprites/ts_pal.s
File diff suppressed because it is too large
View File


+ 1030
- 0
data/trainer_sprites/ts_tiles.s
File diff suppressed because it is too large
View File


+ 2
- 0
gfx_build/trainer_sprites/.gitignore View File

@@ -0,0 +1,2 @@
1
+*.o
2
+*.s

+ 5
- 0
main.asm View File

@@ -36,6 +36,8 @@
36 36
 
37 37
 .include "patches/overworlds/overworld.asm"
38 38
 
39
+.include "patches/trainer_sprites/images.asm"
40
+
39 41
 .include "patches/interface.asm"
40 42
 
41 43
 .include "patches/battle_engine/malloc.asm"
@@ -43,6 +45,9 @@
43 45
 
44 46
 .include "patches/text_system.asm"
45 47
 
48
+.org 0x0815F9B8
49
+    .word 0x08069ED5 // fix nop1 for now...
50
+
46 51
 .org 0x09000000
47 52
 .importobj "object/linked.o"
48 53
 .close

+ 56
- 3
nbproject/configurations.xml View File

@@ -5,11 +5,21 @@
5 5
       <df name="data">
6 6
         <df name="text_lookup">
7 7
           <in>text_lookup_array.s</in>
8
+          <in>text_lookup_trainer.s</in>
8 9
           <in>text_multichoice.s</in>
9 10
         </df>
11
+        <df name="trainer_sprites">
12
+          <in>ts_alt.s</in>
13
+          <in>ts_pal.s</in>
14
+          <in>ts_tiles.s</in>
15
+        </df>
10 16
         <in>raw_defines.s</in>
11 17
       </df>
12 18
       <df name="patches">
19
+        <df name="trainer_sprites">
20
+          <in>altitude.asm</in>
21
+          <in>images.asm</in>
22
+        </df>
13 23
         <in>interface.asm</in>
14 24
         <in>text_system.asm</in>
15 25
       </df>
@@ -143,16 +153,24 @@
143 153
           <in>custom_specials.c</in>
144 154
           <in>cutscene_meteor.c</in>
145 155
           <in>load_text_special.c</in>
156
+          <in>trainer_battle.c</in>
146 157
         </df>
147 158
       </df>
148 159
       <df name="string">
149 160
         <df name="de">
150 161
           <df name="story_text">
162
+            <df name="hesperia">
163
+              <in>globals.txt</in>
164
+              <in>player_house.txt</in>
165
+            </df>
151 166
             <df name="tundra_hq">
152 167
               <in>globals.txt</in>
153 168
             </df>
154 169
           </df>
155
-          <in>text.txt</in>
170
+          <df name="trainers">
171
+            <in>test_trainers.txt</in>
172
+          </df>
173
+          <in>invalid.txt</in>
156 174
           <in>text_multichoices.txt</in>
157 175
         </df>
158 176
       </df>
@@ -202,11 +220,22 @@
202 220
             tool="4"
203 221
             flavor2="0">
204 222
       </item>
223
+      <item path="data/text_lookup/text_lookup_trainer.s"
224
+            ex="false"
225
+            tool="4"
226
+            flavor2="0">
227
+      </item>
205 228
       <item path="data/text_lookup/text_multichoice.s"
206 229
             ex="false"
207 230
             tool="4"
208 231
             flavor2="0">
209 232
       </item>
233
+      <item path="data/trainer_sprites/ts_alt.s" ex="false" tool="4" flavor2="0">
234
+      </item>
235
+      <item path="data/trainer_sprites/ts_pal.s" ex="false" tool="4" flavor2="0">
236
+      </item>
237
+      <item path="data/trainer_sprites/ts_tiles.s" ex="false" tool="4" flavor2="0">
238
+      </item>
210 239
       <folder path="0/sots-private">
211 240
         <cTool>
212 241
           <incDir>
@@ -466,6 +495,13 @@
466 495
       </item>
467 496
       <item path="patches/text_system.asm" ex="false" tool="4" flavor2="0">
468 497
       </item>
498
+      <item path="patches/trainer_sprites/altitude.asm"
499
+            ex="false"
500
+            tool="4"
501
+            flavor2="0">
502
+      </item>
503
+      <item path="patches/trainer_sprites/images.asm" ex="false" tool="4" flavor2="0">
504
+      </item>
469 505
       <item path="sots-private/sound/Assembler/musicInjector.c"
470 506
             ex="false"
471 507
             tool="0"
@@ -644,15 +680,32 @@
644 680
       </item>
645 681
       <item path="src/specials/load_text_special.c" ex="false" tool="0" flavor2="0">
646 682
       </item>
647
-      <item path="string/de/story_text/tundra_hq/globals.txt"
683
+      <item path="src/specials/trainer_battle.c" ex="false" tool="0" flavor2="0">
684
+      </item>
685
+      <item path="string/de/invalid.txt" ex="false" tool="3" flavor2="0">
686
+      </item>
687
+      <item path="string/de/story_text/hesperia/globals.txt"
688
+            ex="false"
689
+            tool="3"
690
+            flavor2="0">
691
+      </item>
692
+      <item path="string/de/story_text/hesperia/player_house.txt"
648 693
             ex="false"
649 694
             tool="3"
650 695
             flavor2="0">
651 696
       </item>
652
-      <item path="string/de/text.txt" ex="false" tool="3" flavor2="0">
697
+      <item path="string/de/story_text/tundra_hq/globals.txt"
698
+            ex="false"
699
+            tool="3"
700
+            flavor2="0">
653 701
       </item>
654 702
       <item path="string/de/text_multichoices.txt" ex="false" tool="3" flavor2="0">
655 703
       </item>
704
+      <item path="string/de/trainers/test_trainers.txt"
705
+            ex="false"
706
+            tool="3"
707
+            flavor2="0">
708
+      </item>
656 709
     </conf>
657 710
   </confs>
658 711
 </configurationDescriptor>

+ 1398
- 4
nbproject/private/configurations.xml
File diff suppressed because it is too large
View File


+ 6
- 37
nbproject/private/private.xml View File

@@ -19,43 +19,12 @@
19 19
     </editor-bookmarks>
20 20
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
21 21
         <group>
22
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/battle_help.c</file>
23
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/moves.h</file>
24
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/custom_structs_malloc.c</file>
25
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/specials/cutscene_meteor.c</file>
26
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle.h</file>
27
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/makefile</file>
28
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_script.h</file>
29
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/memory.h</file>
30
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/overworld/overworld.c</file>
31
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_locations.h</file>
32
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/attack_names.h</file>
33
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_abilities.h</file>
34
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/pkmn_abilities.h</file>
35
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/game_engine.h</file>
36
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/battle_initiative.c</file>
37
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/interface/textbox_mugshots.c</file>
38
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/patches/hooks.asm</file>
39
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/battle_abilities.c</file>
40
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/types.h</file>
41
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_test.h</file>
42
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_initiative.h</file>
43
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/pkmn_item_effects.h</file>
44
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/moves/ability_changers/ability_change.c</file>
45
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/specials/custom_specials.c</file>
46
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/pkmn_attributes.h</file>
47
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/lcd.h</file>
48
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/math.h</file>
49
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/moves/feint/feint.c</file>
50
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_help.h</file>
51
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/battle_test.c</file>
52
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/specials/camera_move.c</file>
53
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/debug.h</file>
54
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/string/de/item_data.txt</file>
55
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/include/battle_structs.h</file>
56
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/debug/debug.c</file>
57
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/battle_engine/entry_hazards.c</file>
58
-            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/src/moves/assurance/assurance.c</file>
22
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/assets.makefile</file>
23
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/string/de/story_text/hesperia/player_house.txt</file>
24
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/data/text_lookup/text_lookup_array.s</file>
25
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/string/table.tbl</file>
26
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/string/de/story_text/hesperia/globals.txt</file>
27
+            <file>file:/C:/cygwin64/home/Philipp/sots/engine/source_of_the_sovereign/string/de/story_text/tundra_hq/globals.txt</file>
59 28
         </group>
60 29
     </open-files>
61 30
 </project-private>

+ 12
- 12
patches/dns/core.asm View File

@@ -1,22 +1,22 @@
1 1
 .org 0x08059A90
2
-    ldr r3, =dns_mapdata_load_palette_one+1
3
-    bx r3
4
-    .pool
2
+    //ldr r3, =dns_mapdata_load_palette_one+1
3
+   // bx r3
4
+    //.pool
5 5
 
6 6
 .org 0x08059AA0
7
-    ldr r3, =dns_mapdata_load_palette_two+1
8
-    bx r3
9
-    .pool
7
+    //ldr r3, =dns_mapdata_load_palette_two+1
8
+    //bx r3
9
+    //.pool
10 10
 
11 11
 .org 0x0805F538
12
-    ldr r2, =dns_pal_patch_for_npc+1
13
-    bx r2
14
-    .pool
12
+    //ldr r2, =dns_pal_patch_for_npc+1
13
+    //bx r2
14
+    //.pool
15 15
 
16 16
 .org 0x08083614
17
-    ldr r1, =dns_overworld_anim_load_pal+1
18
-    bx r1
19
-    .pool
17
+    //ldr r1, =dns_overworld_anim_load_pal+1
18
+    //bx r1
19
+    //.pool
20 20
 
21 21
 .org 0x08056578
22 22
     //ldr r0, =dns_cb_overworld_hacked+1

+ 2
- 2
patches/special.asm View File

@@ -2,10 +2,10 @@
2 2
 .word sp_special_casm|1
3 3
 
4 4
 .org 0x0815FD60 + (4*0x69)
5
-.word get_text_pointer_from_lookup|1
5
+.word sp_load_text_person|1
6 6
 
7 7
 .org 0x0815FD60 + (4*0x6A)
8
-.word get_map_pointer_from_lookup|1
8
+.word sp_load_text_map|1
9 9
 
10 10
 .org 0x0815FD60 + (4*0x6B)
11 11
 .word sp_clear_variables|1

+ 4
- 1
patches/text_system.asm View File

@@ -4,4 +4,7 @@
4 4
 .org 0x0809CFD4
5 5
 .word multichoice_array
6 6
 
7
-
7
+.org 0x08080228
8
+    ldr r1, =tb_configure_by_script+1
9
+    bx r1
10
+    .pool

+ 11
- 0
patches/trainer_sprites/altitude.asm View File

@@ -0,0 +1,11 @@
1
+.org 0x08037E78
2
+    .word ts_alt_table
3
+
4
+.org 0x0803804C
5
+    .word ts_alt_table
6
+
7
+.org 0x0803CAD4
8
+    .word ts_alt_table
9
+
10
+.org 0x08158514
11
+    .word ts_alt_table

+ 60
- 0
patches/trainer_sprites/images.asm View File

@@ -0,0 +1,60 @@
1
+.org 0x0803473C 
2
+.word ts_image_maintable
3
+ 
4
+.org 0x080347A4 
5
+.word ts_image_maintable
6
+ 
7
+.org 0x08037E8C 
8
+.word ts_image_maintable
9
+ 
10
+.org 0x08038060 
11
+.word ts_image_maintable
12
+ 
13
+.org 0x0803CAE8 
14
+.word ts_image_maintable
15
+ 
16
+.org 0x080838E4 
17
+.word ts_image_maintable
18
+ 
19
+.org 0x08083928 
20
+.word ts_image_maintable
21
+ 
22
+.org 0x0810BC3C 
23
+.word ts_image_maintable
24
+ 
25
+.org 0x08158528 
26
+.word ts_image_maintable
27
+
28
+
29
+.org 0x0803474C 
30
+.word ts_pal_maintable
31
+ 
32
+.org 0x080347A0 
33
+.word ts_pal_maintable
34
+ 
35
+.org 0x08037E88 
36
+.word ts_pal_maintable
37
+ 
38
+.org 0x0803805C 
39
+.word ts_pal_maintable
40
+ 
41
+.org 0x0803CAE4 
42
+.word ts_pal_maintable
43
+ 
44
+.org 0x080838E0 
45
+.word ts_pal_maintable
46
+ 
47
+.org 0x0808392C 
48
+.word ts_pal_maintable
49
+ 
50
+.org 0x0810BD1C 
51
+.word ts_pal_maintable
52
+ 
53
+.org 0x0810BD3C 
54
+.word ts_pal_maintable
55
+ 
56
+.org 0x0810BD7C 
57
+.word ts_pal_maintable
58
+ 
59
+.org 0x08158524 
60
+.word ts_pal_maintable

+ 12
- 1
sprites.makefile View File

@@ -22,6 +22,9 @@ SPRITE_BACK_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/back_sprites/,$(notdir $(
22 22
 OW_PNG = $(sort $(wildcard $(ASSET_ROOT)/overworld/*.png))
23 23
 OW_OBJ = $(addprefix $(GFX_BUILD_DIR)/overworlds/,$(notdir $(OW_PNG:.png=.o)))
24 24
 
25
+TS_PNG = $(sort $(wildcard $(ASSET_ROOT)/trainer_sprites/*.png))
26
+TS_OBJ = $(addprefix $(GFX_BUILD_DIR)/trainer_sprites/,$(notdir $(TS_PNG:.png=.o)))
27
+
25 28
 CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
26 29
 NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
27 30
 SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
@@ -40,7 +43,7 @@ clean:
40 43
 	rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
41 44
 	rm -f $(GFX_BUILD_DIR)/overworlds/*
42 45
 
43
-$(SPRITES_BINARY): $(NORMAL_PAL_OBJ) $(SHINY_PAL_OBJ) $(SPRITE_FRONT_OBJ) $(SPRITE_BACK_OBJ) $(NORMAL_CASTFORM_PAL_OBJ) $(SHINY_CASTFORM_PAL_OBJ) $(CASTFORM_FRONT_OBJ) $(CASTFORM_BACK_OBJ) $(OW_OBJ)
46
+$(SPRITES_BINARY): $(NORMAL_PAL_OBJ) $(SHINY_PAL_OBJ) $(SPRITE_FRONT_OBJ) $(SPRITE_BACK_OBJ) $(NORMAL_CASTFORM_PAL_OBJ) $(SHINY_CASTFORM_PAL_OBJ) $(CASTFORM_FRONT_OBJ) $(CASTFORM_BACK_OBJ) $(OW_OBJ) $(TS_OBJ)
44 47
 	rm -f $(TMP_FILE2)
45 48
 	rm -f $(TMP_FILE)
46 49
 	for file in $^;\
@@ -62,6 +65,14 @@ $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
62 65
 $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
63 66
 	grit $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
64 67
 
68
+# Trainer Sprite Targets
69
+$(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
70
+	$(AS) -o $@ $<
71
+
72
+.PRECIOUS: $(GFX_BUILD_DIR)/trainer_sprites/%.s
73
+$(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
74
+	grit $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
75
+
65 76
 # Normal Palette Targets
66 77
 $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
67 78
 	$(AS) -o $@ $<

+ 1
- 1
src/include/assets/interface/arrows.img.h View File

@@ -7,7 +7,7 @@
7 7
 //	+ 24 tiles not compressed
8 8
 //	Total size: 768 = 768
9 9
 //
10
-//	Time-stamp: 2017-01-01, 16:49:47
10
+//	Time-stamp: 2017-01-04, 23:39:13
11 11
 //	Exported by Cearn's GBA Image Transmogrifier, v0.8.6
12 12
 //	( http://www.coranac.com/projects/#grit )
13 13
 //

BIN
src/include/assets/interface/emoticons.img.bin View File


+ 1
- 1
src/include/assets/interface/emoticons.img.h View File

@@ -7,7 +7,7 @@
7 7
 //	+ 60 tiles not compressed
8 8
 //	Total size: 1920 = 1920
9 9
 //
10
-//	Time-stamp: 2017-01-01, 16:49:47
10
+//	Time-stamp: 2017-01-04, 23:39:13
11 11
 //	Exported by Cearn's GBA Image Transmogrifier, v0.8.6
12 12
 //	( http://www.coranac.com/projects/#grit )
13 13
 //

+ 0
- 1
src/specials/custom_specials.c View File

@@ -71,7 +71,6 @@ static callback special_routines[6] = {
71 71
     sp_init_script,
72 72
     debug_some_test,
73 73
     sp_dns_switch,
74
-    get_text_pointer_from_lookup+1,
75 74
 };
76 75
 
77 76
 /* === IMPLEMENTATIONS === */

+ 151
- 3
src/specials/load_text_special.c View File

@@ -1,12 +1,160 @@
1
+/****************************************************************************
2
+ * Copyright (C) 2015-2016 by the SotS Team                                 *
3
+ *                                                                          *
4
+ * This file is part of Sovereign of the Skies.                             *
5
+ *                                                                          *
6
+ *   Sovereign of the Skies is free software: you can redistribute it       *
7
+ *   and/or modify it                                                       *
8
+ *   under the terms of the GNU Lesser General Public License as published  *
9
+ *   by the Free Software Foundation, either version 3 of the License, or   *
10
+ *   (at your option) any later version provided you include a copy of the  *
11
+ *   licence and this header.                                               *
12
+ *                                                                          *
13
+ *   Sovereign of the Skies is distributed in the hope that it will be      *
14
+ *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
16
+ *   GNU Lesser General Public License for more details.                    *
17
+ *                                                                          *
18
+ *   You should have received a copy of the GNU Lesser General Public       *
19
+ *   License along with Sovereign of the Skies.                             *
20
+ *   If not, see <http://www.gnu.org/licenses/>.                            *
21
+ ****************************************************************************/
22
+
23
+/**
24
+ * @file load_text_special.c
25
+ * @author Sturmvogel
26
+ * @date 05 Jan 2016
27
+ * @brief special 0x69 0x6A
28
+ * 
29
+ * Implements a new way to load text for more language compatability and code
30
+ * interchangability.
31
+ */
32
+
33
+/* === INCLUDE === */
1 34
 #include <types.h>
2 35
 #include <game_engine.h>
3 36
 #include <config.h>
4
-extern char** text_lookup_array;   
37
+
38
+/* === STRUCTURES === */
39
+struct lt_point
40
+{
41
+    u16 x;
42
+    u16 y;
43
+};
44
+
45
+struct lt_warpdata
46
+{
47
+    u8 bank;
48
+    u8 map;
49
+    u8 warpid;
50
+    u8 unknown;
51
+    u16 enter_x;
52
+    u16 enter_y;
53
+};
54
+
55
+struct sav_struct
56
+{
57
+    struct lt_point position;
58
+    struct lt_warpdata location;
59
+};
60
+
61
+/* === PROTOTYPES === */
62
+
63
+/**
64
+ * @brief load text according to bank, map and text_id
65
+ */
66
+void sp_load_text_map();
67
+
68
+/**
69
+ * @brief load text according to bank, map, person id and text_id
70
+ */
71
+void sp_load_text_person();
72
+
73
+/* === GLOBALS === */
74
+extern struct sav_struct* sav_one;
75
+
76
+char* str_invalid_text_ref;
77
+char***** text_lookup_table;   
5 78
 
6 79
 void** loadpointer = (void**)((0x03000EB0 + 0x64));
7
-extern char* get_text_pointer_from_lookup();
80
+
81
+/* === IMPLEMENTATIONS === */
82
+void sp_load_text_map()
83
+{
84
+    u8 bank = sav_one->location.bank;
85
+    u8 map = sav_one->location.map;
86
+    for(int i = 0; i<=bank;++i)
87
+    {
88
+        if(text_lookup_table[i] == (char****)(0xDEADBEEF))
89
+        {
90
+            *loadpointer =str_invalid_text_ref;
91
+            return;
92
+        }
93
+    }
94
+    for(int i = 0; i<=map; ++i)
95
+    {
96
+        if(text_lookup_table[bank][i] == (char***)(0xDEADBEEF))
97
+        {
98
+            *loadpointer = str_invalid_text_ref;
99
+            return;
100
+        }
101
+    }
102
+    if(text_lookup_table[bank][map][0] == (char**)(0xDEADBEEF))
103
+    {
104
+        *loadpointer = str_invalid_text_ref;
105
+        return;
106
+    }
107
+    u16 text_id = var_get(0x500C);
108
+    for(int i = 0; i<= text_id; ++i)
109
+    {
110
+        if(text_lookup_table[bank][map][0][i] == (char*)(0xDEADBEEF))
111
+        {
112
+            *loadpointer = str_invalid_text_ref;
113
+            return;
114
+        }
115
+    }
116
+    *loadpointer = text_lookup_table[bank][map][0][text_id];
117
+    return;
118
+}
119
+
8 120
 void sp_load_text_person()
9 121
 {
10
-    *loadpointer = get_text_pointer_from_lookup();
122
+    u8 bank = sav_one->location.bank;
123
+    u8 map = sav_one->location.map;
124
+    for(int i = 0; i<= bank; ++i)
125
+    {
126
+        if(text_lookup_table[i] == (char****)(0xDEADBEEF))
127
+        {
128
+            *loadpointer = str_invalid_text_ref;
129
+            return;
130
+        }
131
+    }
132
+    for(int i = 0; i<= bank; ++i)
133
+    {
134
+        if(text_lookup_table[bank][i] == (char***) (0xDEADBEEF))
135
+        {
136
+            *loadpointer = str_invalid_text_ref;
137
+            return;
138
+        }
139
+    }
140
+    u16 person_id = var_get(0x800F);    // LASTTALKED
141
+    for(int i = 0; i<= person_id; ++i)
142
+    {
143
+        if(text_lookup_table[bank][map][i] == (char**) (0xDEADBEEF))
144
+        {
145
+            *loadpointer = str_invalid_text_ref;
146
+            return;
147
+        }
148
+    }
149
+    u16 text_id = var_get(0x500C);   //TEXT_VAR
150
+    for(int i = 0; i<= text_id; ++i)
151
+    {
152
+        if(text_lookup_table[bank][map][person_id][i] == (char*) (0xDEADBEEF))
153
+        {
154
+            *loadpointer = str_invalid_text_ref;
155
+            return;
156
+        }
157
+    }
158
+    *loadpointer = text_lookup_table[bank][map][person_id][text_id];
11 159
     return;
12 160
 }

+ 311
- 0
src/specials/trainer_battle.c View File

@@ -0,0 +1,311 @@
1
+/****************************************************************************
2
+ * Copyright (C) 2015-2016 by the SotS Team                                 *
3
+ *                                                                          *
4
+ * This file is part of Sovereign of the Skies.                             *
5
+ *                                                                          *
6
+ *   Sovereign of the Skies is free software: you can redistribute it       *
7
+ *   and/or modify it                                                       *
8
+ *   under the terms of the GNU Lesser General Public License as published  *
9
+ *   by the Free Software Foundation, either version 3 of the License, or   *
10
+ *   (at your option) any later version provided you include a copy of the  *
11
+ *   licence and this header.                                               *
12
+ *                                                                          *
13
+ *   Sovereign of the Skies is distributed in the hope that it will be      *
14
+ *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
16
+ *   GNU Lesser General Public License for more details.                    *
17
+ *                                                                          *
18
+ *   You should have received a copy of the GNU Lesser General Public       *
19
+ *   License along with Sovereign of the Skies.                             *
20
+ *   If not, see <http://www.gnu.org/licenses/>.                            *
21
+ ****************************************************************************/
22
+
23
+/**
24
+ * @file trainer_battle.c
25
+ * @author Sturmvogel
26
+ * @date 04 Jan 2014
27
+ * @brief trainerbattle script command overhaul
28
+ * 
29
+ */
30
+
31
+/* === INCLUDE === */
32
+
33
+#include <types.h>
34
+#include <game_engine.h>
35
+#include <debug.h>
36
+#include <config.h>
37
+#include <callback.h>
38
+
39
+/* === ENGINE EXTERNS === */
40
+extern void battle_init();
41
+extern void battle_80801F0_something();
42
+
43
+extern volatile u8 trainerbattle_battle_type;
44
+extern volatile u16 trainerbattle_flag_id;
45
+extern volatile u16 trainerbattle_arg2;
46
+extern volatile char* trainerbattle_message_intro;
47
+extern volatile char* trainerbattle_message_defeat;
48
+extern volatile char* trainerbattle_message_2;
49
+extern volatile char* trainerbattle_message_need_2_poke;
50
+extern volatile char* trainerbattle_message_4;
51
+extern volatile void* trainerbattle_next_scr_cmd;
52
+extern volatile u16 trainerbattle_unknown;
53
+
54
+char*** trainer_text_array;
55
+char* str_invalid_text_ref;
56
+
57
+/* === PROTOTYPES === */
58
+
59
+/* === IMPLEMENTATIONS === */
60
+
61
+/**
62
+ * @brief loads a byte
63
+ * @param ptr pointer to load byte from
64
+ * @return byte loaded
65
+ */
66
+u8 load_byte(void* ptr)
67
+{
68
+    u8* to_load = (u8*)ptr;
69
+    return (u8)(*to_load);
70
+}
71
+
72
+/**
73
+ * @brief loads an unaligned hword
74
+ * @param ptr pointer to load from
75
+ * @return half word at pointer
76
+ */
77
+u16 load_hword(void* ptr)
78
+{
79
+    u8* to_load = (u8*)ptr;
80
+    u16 result = *to_load;
81
+    u16 result2 = *(to_load+1) << 8;
82
+    return result | result2;
83
+}
84
+
85
+/**
86
+ * @brief loads an unaligned word
87
+ * @param ptr pointer to load from
88
+ * @return word read at pointer
89
+ */
90
+u32 load_word(void* ptr)
91
+{
92
+    u8* to_load = (u8*)ptr;
93
+    u32 result = *to_load;
94
+    u32 result2 = *(to_load+1);
95
+    u32 result3 = *(to_load+2);
96
+    u32 result4 = *(to_load+3);
97
+    return (result) | (result2 << 8) | (result3 << 16) | (result4 << 24);
98
+}
99
+
100
+/**
101
+ * @brief modifies the given flag by game difficulty
102
+ * @param flag flag to modify
103
+ * @return flag +1 for medium, flag +2 for hard
104
+ */
105
+u16 tb_modify_flag_id(u16 flag)
106
+{
107
+    u16 difficulty = var_get(0x5052);
108
+    switch(difficulty)
109
+    {
110
+        case 0:
111
+            return flag;
112
+        case 1:
113
+            return flag + 1;
114
+        case 2:
115
+            return flag + 2;
116
+    }
117
+    assert(0);
118
+}
119
+
120
+/**
121
+ * @brief modifies null text pointers according to the trainer text table
122
+ * @param original original pointer, will be modified only if equal to NULL
123
+ * @param index index of the requested text in the trainer table
124
+ * @return 
125
+ */
126
+char* tb_modify_text(char* original, u8 index)
127
+{
128
+    if(original != NULL)
129
+        return original;
130
+    u8 flag_index = trainerbattle_flag_id;   /* NOTE: divide by 3 eventually */
131
+    for(int i = 0; i <= flag_index; ++i)
132
+    {
133
+        if(trainer_text_array[i] == (char**)0xDEADBEEF)
134
+        {
135
+            return str_invalid_text_ref;
136
+        }
137
+    }
138
+    for(int i = 0; i <= index; ++i)
139
+    {
140
+        if(trainer_text_array[flag_index][i] == (char*)0xDEADBEEF)
141
+        {
142
+            return str_invalid_text_ref;
143
+        }
144
+    }
145
+    return trainer_text_array[flag_index][index];
146
+}
147
+
148
+/**
149
+ * @brief read parameters and initialize a trainerbattle instance
150
+ * @param ptr_script pointer to current executed script
151
+ * @return new script pointer
152
+ */
153
+void* tb_configure_by_script(void* ptr_script)
154
+{
155
+    battle_init();
156
+    trainerbattle_battle_type = load_byte(ptr_script);
157
+    switch(trainerbattle_battle_type)
158
+    {
159
+        case 1:
160
+        case 2:
161
+            trainerbattle_battle_type = load_byte(ptr_script);
162
+            ptr_script++;
163
+            
164
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
165
+            ptr_script+=2;
166
+            
167
+            trainerbattle_arg2 = load_hword(ptr_script);
168
+            ptr_script+=2;
169
+            
170
+            trainerbattle_message_intro = tb_modify_text((char*)load_word(ptr_script), 0);
171
+            ptr_script+=4;
172
+            
173
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 1);
174
+            ptr_script+=4;
175
+            
176
+            trainerbattle_message_2 = NULL;
177
+            trainerbattle_message_need_2_poke = NULL;
178
+            
179
+            trainerbattle_message_4 = tb_modify_text((char*)load_word(ptr_script), 2);
180
+            ptr_script+=4;
181
+            trainerbattle_next_scr_cmd = ptr_script;
182
+            battle_80801F0_something();
183
+            return (void*) (0x081A4EC1) /* some script to execute */;
184
+        case 3:
185
+            trainerbattle_battle_type = load_byte(ptr_script);
186
+            
187
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
188
+            ptr_script+=2;
189
+            
190
+            trainerbattle_arg2 = load_hword(ptr_script);
191
+            ptr_script+=2;
192
+            
193
+            trainerbattle_message_intro = NULL;
194
+            
195
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 0);
196
+            ptr_script++;
197
+            
198
+            trainerbattle_message_2 = NULL;
199
+            trainerbattle_message_need_2_poke = NULL;
200
+            
201
+            trainerbattle_message_4 = NULL;
202
+            
203
+            trainerbattle_next_scr_cmd = ptr_script;
204
+            return (void*) (0x081A4F21); /* some script to execute*/
205
+        case 4:
206
+            trainerbattle_battle_type = load_byte(ptr_script);
207
+            ptr_script++;
208
+            
209
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
210
+            ptr_script+=2;
211
+            
212
+            trainerbattle_arg2 = load_hword(ptr_script);
213
+            ptr_script+=2;
214
+            
215
+            trainerbattle_message_intro = tb_modify_text((char*)load_word(ptr_script), 0);
216
+            ptr_script+=4;
217
+            
218
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 1);
219
+            ptr_script+=4;
220
+            
221
+            trainerbattle_message_2 = NULL;
222
+            
223
+            trainerbattle_message_need_2_poke = tb_modify_text((char*)load_word(ptr_script), 2);
224
+            ptr_script+= 4;
225
+            
226
+            trainerbattle_message_4 = NULL;
227
+            ptr_script+= 4;
228
+            trainerbattle_next_scr_cmd = ptr_script;
229
+            battle_80801F0_something();
230
+            return (void*) (0x081A4EE9); /* some script to execute */
231
+        case 5:
232
+            assert(0);
233
+            return NULL;
234
+        case 6:
235
+        case 8:
236
+            trainerbattle_battle_type = load_byte(ptr_script);
237
+            ptr_script++;
238
+            
239
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
240
+            ptr_script+=2;
241
+            
242
+            trainerbattle_arg2 = load_hword(ptr_script);
243
+            ptr_script+=2;
244
+            
245
+            trainerbattle_message_intro = tb_modify_text((char*)load_word(ptr_script), 0);
246
+            ptr_script+=4;
247
+            
248
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 1);
249
+            ptr_script+=4;
250
+            
251
+            trainerbattle_message_2 = NULL;
252
+            
253
+            trainerbattle_message_need_2_poke = tb_modify_text((char*)load_word(ptr_script), 2);
254
+            ptr_script += 4;
255
+            trainerbattle_message_4 = tb_modify_text((char*)load_word(ptr_script), 3);
256
+            ptr_script += 4;
257
+            trainerbattle_next_scr_cmd = ptr_script;
258
+            battle_80801F0_something();
259
+            return (void*) (0x081A4EE9); /* some script to execute */
260
+        case 7:
261
+            assert(0);
262
+            return NULL;
263
+        case 9:
264
+            /* WIN / LOSE resume script */
265
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
266
+            ptr_script += 2;
267
+            
268
+            trainerbattle_unknown = load_hword(ptr_script);
269
+            ptr_script += 2;
270
+            
271
+            trainerbattle_message_intro = NULL;
272
+            
273
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 0);
274
+            ptr_script += 4;
275
+            
276
+            trainerbattle_message_2 = tb_modify_text((char*)load_word(ptr_script), 1);
277
+            ptr_script += 4;
278
+            
279
+            trainerbattle_message_need_2_poke = NULL;
280
+            
281
+            trainerbattle_message_4 = NULL;
282
+            
283
+            trainerbattle_next_scr_cmd = ptr_script;
284
+            return (void*) 0x081A4F21; /* some script to execute */
285
+        default:
286
+            trainerbattle_battle_type = load_byte(ptr_script);
287
+            ptr_script++;
288
+            
289
+            trainerbattle_flag_id = tb_modify_flag_id(load_hword(ptr_script));
290
+            ptr_script+=2;
291
+            
292
+            trainerbattle_arg2 = load_hword(ptr_script);
293
+            ptr_script+=2;
294
+            
295
+            trainerbattle_message_intro = tb_modify_text((char*)load_word(ptr_script), 0);
296
+            ptr_script+=4;
297
+            
298
+            trainerbattle_message_defeat = tb_modify_text((char*)load_word(ptr_script), 1);
299
+            ptr_script+=4;
300
+            
301
+            trainerbattle_message_2 = NULL;
302
+            trainerbattle_message_need_2_poke = NULL;
303
+            trainerbattle_message_4 = NULL;
304
+            trainerbattle_next_scr_cmd = ptr_script;
305
+            battle_80801F0_something();
306
+            return (void*) (0x081A4EC1); /* some script to execute */
307
+    }
308
+    /* should never be reached */
309
+    //assert(0);
310
+   // return NULL;
311
+}

+ 1
- 0
string/de/invalid.txt View File

@@ -0,0 +1 @@
1
+str_invalid_text=Dies ist ein Dummy Text!

+ 25
- 0
string/de/story_text/hesperia/globals.txt View File

@@ -0,0 +1,25 @@
1
+str_hesp_out_g_0=\v\h01! Was bitte war das!? Diese\nErschütterung\.\p\c\h08\h05.\c\h08\h05.\c\h08\h05.\c\h08\h05.\c\h08\h05.\pIch bin so froh, dass dir nichts\npassiert ist\.\pEs hörte sich an wie ein\nErdbeben\c\h08\h05.\c\h08\h05.\c\h08\h05.\pVielleicht weiß dein Vater ja, was\nvorgefallen ist.\pMach dich bitte auf den Weg mein\nSchatz.\pIch werde wieder reingehen, pass\nbitte auf dich auf!
2
+str_hesp_out_g_1=\v\h01! Warte!
3
+str_hesp_out_g_2=Tut mir Leid, ich bin spät dran\.\pHast du auch diese Vibration\ngespürt, als hätte es ein Erdbeben\lgegeben oder so was\.\pIch mache mir Sorgen, hoffentlich\nist niemandem etwas passiert\.\pMeinst du nicht wir sollten Vater\naufsuchen?\pKommt lass uns gehen!
4
+str_hesp_out_g_3=Ah sieh mal! Da ist er ja!
5
+str_hesp_out_g_4=Achim! Bilde ich mir das jetzt\nein oder gab es gerade ein hefiges\lErdbeben östlich von Hesperia?
6
+str_hesp_out_g_5=Das ist keine Einbildung, ich habe\nes ebenfalls gespürt.\pUnd habe ehrlich gesagt ein\nkomisches Gefühl\.\pDenn was auch immer es war, ein\ngewöhnliches Beben war es zumindest\lnicht.
7
+str_hesp_out_g_6=Du hast Recht!\pDer Himmel färbte sich rot und es\nwurde plötzlich so düster und\lstill.\pUnd dann diese Explosion\.\pIch fürchte es war kein Erdbeben\.\pEs muss einen anderen Ursprung\nhaben!
8
+str_hesp_out_g_7=Das erfahren wir erst, wenn wir\nNachforschungen betreiben.\pWenn du mich kurz entschuldigst.\pIch werde etwas telefonieren,\num herauszufinden, was passiert\list.\pWarte du hier auf deine Kinder.
9
+str_hesp_out_g_8=Ah, da seit ihr ja!\pLeider ist uns etwas dazwischen\ngekommen. Wir müssen mit dem\lwarten, was wir vorhatten.
10
+str_hesp_out_g_9=Meinst du vielleicht mit "etwas\ndazwischen" gekommen, das Erdbeben?
11
+str_hesp_out_g_10=Wie? Dann habt ihr es also auch\ngespürt, verstehe\.
12
+str_hesp_out_g_11=Ja, aber ich bin nicht der Einzige.\pAuch Mama und \v\h01 haben es gespürt.
13
+str_hesp_out_g_12=Verstehe\. Es würde mich nicht\nwundern, wenn es nicht alle in\lHesperia gespürt hätten[.]\pWir können aber noch nicht zu\neinhundert Prozent sagen, was es\lwar.\pAchim hört sich um und\ntelefoniert mit ein paar Kollegen.\pVielleicht kann er uns Genaueres\nmitteilen.\pLasst uns auf ihn warten!
14
+str_hesp_out_g_13=Ah, da kommt er ja!
15
+str_hesp_out_g_14=Und? Achim was ist passiert?
16
+str_hesp_out_g_15=Ich weiß gar nicht, wie ich euch\ndas erklären soll\.\pAber\. Ich kanns einfach nicht\nfassen\.\pEin Meteorit hat nördlich von\nCarun City eingeschlagen und alles\lverwüstet.
17
+str_hesp_out_g_16=WAS!? Geht es deiner Familie gut?
18
+str_hesp_out_g_17=Ja, meiner Familie, sowie den\nBewohnern von Carun City ist nicht\lpassiert.\pEs war zwar kein großer Meteorit\nwie der von damals, aber\ldennoch scheint er eine Menge\l verwüstet zu haben.\pDer gesamte nördliche Teil von\nCarun City, Veternia, ist komplett zerstört\lund unbewohnbar.\pEs ist auch derzeit noch nicht\nbekannt, ob es Verletzte oder Tote\lgibt.\pAuszuschließen ist das nicht. Ich\nrechne mit dem Schlimmsten.\pIch muss mich sofort auf den Weg\nmachen!\pUnsere Arbeit können wir ein andermal\nfortsetzen!
19
+str_hesp_out_g_18=Außer Frage, ich komme so schnell\nes möglich ist nach.
20
+str_hesp_out_g_19=Vielen Dank, mein Freund!\pIch verlasse mich auf dich!
21
+str_hesp_out_g_20=Das Ganze ist jetzt sicherlich ein\nbisschen geschmackslos und kommt\lvielleicht plötzlich, aber ich\lwollte euch eigentlich heute euer\lerstes Pokémon schenken!\pEs sollte zunächst eine\nÜberraschung sein, aber ich denke\ldas habe ich euch leider verdorben.\lEs tut mir Leid!\pAber wir sind, wie es jetzt selber\nmitbekommen habt, in einer ernsten\lSituation, also machen wir es\lschnell.\pFolgt mir ins Labor!
22
+str_hesp_out_g_21=Habe ich richtig gehört?\pWir bekommen unser eigenes Pokémon?
23
+str_hesp_out_g_22=\v\h06! \v\h01!\pWorauf wartet ihr!? Wir haben es\neilig!
24
+
25
+str_hesp_20_g_0=Na \v\h01, bist du aufgewacht?\nDein Vater erwartet \v\h06\lund dich bereits im Labor. Wenn du\ldich bereit fühlst, dann lass ihn\lnicht warten.\pMich findest du in der Küche mein\nSchatz.

+ 1
- 0
string/de/story_text/hesperia/player_house.txt View File

@@ -0,0 +1 @@
1
+str_hesp_21_p1_0=Ah, \v\h01! Du bist also auch\naufgewacht.\pMama hat mir gesagt, dass wir\nrunterkommen sollen, sobald wir\laufgewacht sind.\pGeh ruhig vor, ich komme später\nnach.

+ 0
- 1
string/de/story_text/tundra_hq/globals.txt View File

@@ -1,4 +1,3 @@
1
-str_tundra_hq_name=Tundra HQ
2 1
 str_tundra_hq_0=Wähle deinen Schwierigkeitsgrad\naus, um das Spiel zu beginnen!
3 2
 str_tundra_hq_1=Bist du sicher, dass du in diesem\nModus spielen möchtest?
4 3
 str_tundra_hq_2=Dann wähle einen anderen Modus!

+ 0
- 3
string/de/text.txt View File

@@ -1,3 +0,0 @@
1
-str_person_test=Dies ist ein Test\num die Funktionalität\lzu testen!
2
-str_person_zero=Falscher Text!
3
-str_invalid_text=Dies ist ein Dummy Text!

+ 2
- 0
string/de/trainers/test_trainers.txt View File

@@ -0,0 +1,2 @@
1
+str_t0_intro=Ich bin ein Trainer, KAMPF!!
2
+str_t0_defeat=Ugh, hello darkness und so...

+ 3
- 1
string/table.tbl View File

@@ -14,7 +14,7 @@
14 14
 ?=0xAC
15 15
 .=0xAD
16 16
 -=0xAE
17
-\.=0xAF
17
+\.=0xB0
18 18
 é=0x1B
19 19
 ,=0xB8
20 20
 \k=0xB9
@@ -81,5 +81,7 @@ z=0xEE
81 81
 \e=0x35
82 82
 \l=0xFA
83 83
 \p=0xFB
84
+\c=0xFC
85
+\v=0xFD
84 86
 \n=0xFE
85 87
 \x=0xFF