diff options
-rw-r--r-- | src/cutScene.cpp | 59 | ||||
-rw-r--r-- | src/cutScene.h | 25 | ||||
-rw-r--r-- | tools/MovieSettings.py | 81 |
3 files changed, 165 insertions, 0 deletions
diff --git a/src/cutScene.cpp b/src/cutScene.cpp new file mode 100644 index 0000000..27fbafc --- /dev/null +++ b/src/cutScene.cpp @@ -0,0 +1,59 @@ +#include "cutScene.h" + +dScCutScene_c *dScCutScene_c::instance = 0; + +dScCutScene_c *dScCutScene_c::build() { + // return new dScCutScene_c; + void *buffer = AllocFromGameHeap1(sizeof(dScCutScene_c)); + dScCutScene_c *c = new(buffer) dScCutScene_c; + + instance = c; + return c; +} + +dScCutScene_c::dScCutScene_c() : state(this) { +} + + + +int dScCutScene_c::onCreate() { + *CurrentDrawFunc = CutSceneDrawFunc; + + return true; +} + +int dScCutScene_c::onDelete() { + return true; +} + +int dScCutScene_c::onExecute() { + return true; +} + +int dScCutScene_c::onDraw() { + return true; +} + +void CutSceneDrawFunc() { + Reset3DState(); + SetupLYTDrawing(); + DrawAllLayoutsBeforeX(0x81); + RenderEffects(0, 3); + RenderEffects(0, 2); + GXDrawDone(); + RemoveAllFromScnRoot(); + Reset3DState(); + SetCurrentCameraID(1); + DoSpecialDrawing1(); + SetCurrentCameraID(0); + for (int i = 0; i < 4; i++) + RenderEffects(0, 0xB+i); + for (int i = 0; i < 4; i++) + RenderEffects(0, 7+i); + GXDrawDone(); + // Leaving out some stuff here + DrawAllLayoutsAfterX(0x80); + ClearLayoutDrawList(); + SetCurrentCameraID(0); +} + diff --git a/src/cutScene.h b/src/cutScene.h new file mode 100644 index 0000000..e875822 --- /dev/null +++ b/src/cutScene.h @@ -0,0 +1,25 @@ +#ifndef __CUT_SCENE_H +#define __CUT_SCENE_H + +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> + +void CutSceneDrawFunc(); + +class dScCutScene_c : public dScene_c { + public: + dScCutScene_c(); + + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static dScCutScene_c *build(); + static dScCutScene_c *instance; +}; + +#endif + diff --git a/tools/MovieSettings.py b/tools/MovieSettings.py new file mode 100644 index 0000000..b4b1d23 --- /dev/null +++ b/tools/MovieSettings.py @@ -0,0 +1,81 @@ +import struct + +class Settings(object): + class Banner(object): + def __init__(self, name): + self.name = name + self.sounds = [] + + def add_sound(self, delay, sound_id): + self.sounds.append((delay, sound_id)) + + def __init__(self): + self.banners = [] + + def add_banner(self, name): + b = self.Banner(name) + self.banners.append(b) + return b + + def export(self): + header_size = 8 + + offset = header_size + (4 * len(self.banners)) + banner_offsets = [] + banner_data = [] + + for b in self.banners: + banner_offsets.append(offset) + + b_header1 = 'xxxx' # will be replaced later + b_header2 = struct.pack('>I', len(b.sounds)) + b_sounds = map(lambda x: struct.pack('>II', *x), b.sounds) + + offset += 8 + (len(b_sounds) * 8) + + b_data = [b_header1, b_header2] + b_data.extend(b_sounds) + banner_data.append(b_data) + + # now build a string table + str_tab = [] + + for b, b_data in zip(self.banners, banner_data): + b_data[0] = struct.pack('>I', offset) + offset += len(b.name) + 1 + str_tab.append(b.name) + str_tab.append('\0') + + # whatever + file_pieces = [ + 'NWcs', + struct.pack('>I', len(self.banners)) + ] + + file_pieces.extend(map(lambda x: struct.pack('>I', x), banner_offsets)) + + for b_data in banner_data: + file_pieces.extend(b_data) + + file_pieces.extend(str_tab) + + return ''.join(file_pieces) + + + + +s = Settings() + +one = s.add_banner('beef') +one.add_sound(0, 200) +one.add_sound(5, 400) +one.add_sound(20, 600) + +two = s.add_banner('cats') +two.add_sound(5, 20) +two.add_sound(10, 40) + +data = s.export() +open('settings.bin', 'wb').write(data) + + |