Explorar el Código

begin intro scene

SBird1337 hace 5 años
padre
commit
7535f55e39

+ 1
- 2
data/script/debug.s Ver fichero

@@ -8,8 +8,7 @@
8 8
 debug_script:
9 9
     lock
10 10
     faceplayer
11
-    giveitem 1 1 0
12
-    msgbox debug 6
11
+    callasm blackboard_start+1
13 12
     release
14 13
     end
15 14
 

+ 1
- 1
g3headers

@@ -1 +1 @@
1
-Subproject commit 1063239b4b46f6e4b87978f62aee78306e1b4015
1
+Subproject commit 0720ece1962863ff019180c54d999f6f03715f1d

+ 1
- 1
sots-private

@@ -1 +1 @@
1
-Subproject commit 4d72aa52c405b152c28ec008a7c3cfda823e1b5f
1
+Subproject commit 7f84aed2fc12737ff5b959b90b00825bf3d38a67

+ 13
- 0
src/include/scene.h Ver fichero

@@ -0,0 +1,13 @@
1
+#ifndef SCENE_H_
2
+#define SCENE_H_
3
+
4
+#include <pokeagb/pokeagb.h>
5
+
6
+
7
+
8
+void scene_vram_init(SuperCallback vblank_handler, const struct BgConfig* config);
9
+const struct BgConfig scene_default_config[4];
10
+void scene_default_cb_handler(void);
11
+const struct TextColor scene_default_text_color;
12
+
13
+#endif

+ 74
- 0
src/specials/scenes/blackboard_intro.c Ver fichero

@@ -0,0 +1,74 @@
1
+#include <scene_intro/blackboard.h>
2
+#include <pokeagb/pokeagb.h>
3
+#include <scene.h>
4
+
5
+#define BLACKBOARD_TEXT_SPEED 1
6
+
7
+extern pchar *blackboard_text[];
8
+
9
+const struct TextboxTemplate blackboard_box[] = {
10
+    {.bg_id = 0, .x = 4, .y = 7, .width = 6, .height = 3, .pal_id = 15, .charbase = 1},
11
+};
12
+
13
+const u16 blackboard_text_pal[] = 
14
+                            {rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255),
15
+                             rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255),
16
+                             rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255),
17
+                             rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255), rgb5(255, 255, 255)};
18
+
19
+void blackboard_vblank(void) {
20
+    gpu_sprites_upload();
21
+    copy_queue_process();
22
+    gpu_pal_upload();
23
+}
24
+
25
+void blackboard_loop(u8 id) {
26
+    switch(tasks[id].priv[0]){
27
+        case 0:
28
+            bgid_send_tilemap(2);
29
+            rboxid_clear_pixels(0, 0);
30
+            palette_bg_faded_fill_black();
31
+            tasks[id].priv[0]++;
32
+        break;
33
+        case 1:
34
+            gpu_sync_bg_show(0);
35
+            gpu_sync_bg_hide(1);
36
+            gpu_sync_bg_hide(3);
37
+
38
+            gpu_sync_bg_show(2);
39
+            fade_screen(0xFFFFFFFF, 1, 16, 0, 0x0000);
40
+            tasks[id].priv[0]++;
41
+        break;
42
+        case 2:
43
+            if (!pal_fade_control.active)
44
+                tasks[id].priv[0]++;
45
+            break;
46
+        break;
47
+        case 3:
48
+            rboxid_print(0, 1, 0, 0, &scene_default_text_color, BLACKBOARD_TEXT_SPEED,
49
+                         blackboard_text[0]);
50
+            tasks[id].priv[0]++;
51
+        break;
52
+        default:
53
+        break;
54
+    }
55
+}
56
+
57
+void blackboard_load_gfx(void){
58
+    rbox_init_from_templates(&blackboard_box[0]);
59
+    lz77UnCompVram(blackboardTiles, (void *)0x0600C000);
60
+    LZ77UnCompWram(blackboardMap, bgid_get_tilemap(2));
61
+    gpu_pal_apply_compressed(blackboardPal, 0, 32);
62
+    gpu_pal_apply(blackboard_text_pal, 15 * 16, 32);
63
+    bgid_mark_for_sync(0);
64
+}
65
+
66
+void blackboard_start(void) {
67
+    scene_vram_init(blackboard_vblank, &scene_default_config[0]);
68
+    bgid_set_tilemap(0, malloc(0x800));
69
+    bgid_set_tilemap(2, malloc(0x800));
70
+    blackboard_load_gfx();
71
+    u8 tid = task_add(blackboard_loop, 0);
72
+    tasks[tid].priv[0] = 0;
73
+    set_callback2(scene_default_cb_handler);
74
+}

+ 9
- 0
src/specials/scenes/blackboard_text.s Ver fichero

@@ -0,0 +1,9 @@
1
+.align 2
2
+.text
3
+
4
+.global blackboard_text
5
+blackboard_text:
6
+.word bbtext_zero
7
+
8
+bbtext_zero:
9
+    .autostring 40 LAN_DE "Feuer, Wasser, Erde, Luft. Aus den vier Elementen erschuf Arceus einst das Universum, ein Ort voller Chaos, in welchem sich letztlich unsere Welt formen konnte."

+ 88
- 0
src/specials/scenes/scene_common.c Ver fichero

@@ -0,0 +1,88 @@
1
+#include <pokeagb/pokeagb.h>
2
+
3
+#define CPUFSCPY 0
4
+#define CPUFSSET 1
5
+#define CPUModeFS(size, mode) ((size >> 2) | (mode << 24))
6
+
7
+const struct BgConfig scene_default_config[4] = {
8
+    {
9
+        .padding = 0,
10
+        .b_padding = 0,
11
+        .priority = 0,
12
+        .palette = 0,
13
+        .size = 0,
14
+        .map_base = 29,
15
+        .character_base = 0,
16
+        .bgid = 0,
17
+    },
18
+    {
19
+        .padding = 0,
20
+        .b_padding = 0,
21
+        .priority = 1,
22
+        .palette = 0,
23
+        .size = 0,
24
+        .map_base = 28,
25
+        .character_base = 0,
26
+        .bgid = 1,
27
+    },
28
+    {
29
+        .padding = 0,
30
+        .b_padding = 0,
31
+        .priority = 2,
32
+        .palette = 0,
33
+        .size = 0,
34
+        .map_base = 30,
35
+        .character_base = 3,
36
+        .bgid = 2,
37
+    },
38
+    {
39
+        .padding = 0,
40
+        .b_padding = 0,
41
+        .priority = 3,
42
+        .palette = 0,
43
+        .size = 1,
44
+        .map_base = 31,
45
+        .character_base = 3,
46
+        .bgid = 3,
47
+    },
48
+};
49
+
50
+const struct TextColor scene_default_text_color = {0, 1, 2};
51
+
52
+void scene_default_cb_handler(void) {
53
+    if (pal_fade_control.active)
54
+        process_palfade();
55
+    else {
56
+        task_exec();
57
+        objc_exec();
58
+        obj_sync_superstate();
59
+        tilemaps_sync();
60
+        remoboxes_upload_tilesets();
61
+    }
62
+}
63
+
64
+void scene_vram_init(SuperCallback vblank_handler, const struct BgConfig* config) {
65
+    vblank_handler_set(NULL);
66
+    pal_fade_control_and_dead_struct_reset();
67
+    gpu_tile_bg_drop_all_sets(true);
68
+    obj_and_aux_reset_all();
69
+    gpu_tile_obj_tags_reset();
70
+    gpu_pal_allocator_reset();
71
+    rboxes_free();
72
+    tasks_init();
73
+    bg_vram_setup(0, config, 4);
74
+    u32 set = 0;
75
+    CpuFastSet((void *)&set, (void *)0x06000000, CPUModeFS(0x10000, CPUFSSET));
76
+
77
+    bgid_mod_x_offset(0, 0, 0);
78
+    bgid_mod_y_offset(0, 0, 0);
79
+    bgid_mod_x_offset(1, 0, 0);
80
+    bgid_mod_y_offset(1, 0, 0);
81
+    bgid_mod_x_offset(2, 0, 0);
82
+    bgid_mod_y_offset(2, 0, 0);
83
+    bgid_mod_x_offset(3, 0, 0);
84
+    bgid_mod_y_offset(3, 0, 0);
85
+
86
+    vblank_handler_set(vblank_handler);
87
+    interrupts_enable(INTERRUPT_VBLANK);
88
+}

+ 26
- 0
src/specials/special_effects/oam_effects.c Ver fichero

@@ -0,0 +1,26 @@
1
+#include <pokeagb/pokeagb.h>
2
+
3
+const struct OamData oam_effects_test_oam = {.size = 3, .shape = 0, .priority = 0};
4
+
5
+void oac_oam_effects_reposition(struct Object *obj);
6
+
7
+const struct Template oam_effect_test_template = {
8
+    .tiles_tag = 0x4567,
9
+    .pal_tag = 0x4567,
10
+    .oam = &oam_effects_test_oam,
11
+    .animation = SPRITE_NO_ANIMATION,
12
+    .graphics = &pokemon_graphics_front[3],
13
+    .rotscale = SPRITE_NO_ROTSCALE,
14
+    .callback = oac_oam_effects_reposition
15
+};
16
+
17
+void oac_oam_effects_reposition(struct Object *obj) {
18
+    (void)obj;
19
+}
20
+
21
+void oam_effect_spawn(void) {
22
+    gpu_tile_obj_decompress_alloc_tag_and_upload(&pokemon_graphics_front[3]);
23
+    gpu_pal_decompress_alloc_tag_and_upload(&pokemon_palette_shiny[3]);
24
+    u8 object = template_instanciate_forward_search(&oam_effect_test_template, 100,100,0);
25
+    (void) object;
26
+}