From: hgn Date: Sat, 15 Mar 2025 03:16:59 +0000 (+0000) Subject: markers as map icons (0x8), 2version map handling, incorporating more cutscenes X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=ff9ea27ba5b759153d7b0583305368cb427217c8;p=carveJwlIkooP6JGAAIwe30JlM.git markers as map icons (0x8), 2version map handling, incorporating more cutscenes --- diff --git a/content_skaterift/maps/dev_heaven/main.mdl b/content_skaterift/maps/dev_heaven/main.mdl index 62c8374..a0105ea 100644 Binary files a/content_skaterift/maps/dev_heaven/main.mdl and b/content_skaterift/maps/dev_heaven/main.mdl differ diff --git a/content_skaterift/maps/dev_tutorial/main.mdl b/content_skaterift/maps/dev_tutorial/main.mdl index 6ced7e2..5264be9 100644 Binary files a/content_skaterift/maps/dev_tutorial/main.mdl and b/content_skaterift/maps/dev_tutorial/main.mdl differ diff --git a/content_skaterift/maps/mp_mtzero/before.mdl b/content_skaterift/maps/mp_mtzero/before.mdl new file mode 100644 index 0000000..117556a Binary files /dev/null and b/content_skaterift/maps/mp_mtzero/before.mdl differ diff --git a/content_skaterift/maps/mp_mtzero/main.mdl b/content_skaterift/maps/mp_mtzero/main.mdl index 8e5b2a9..85b238f 100644 Binary files a/content_skaterift/maps/mp_mtzero/main.mdl and b/content_skaterift/maps/mp_mtzero/main.mdl differ diff --git a/content_skaterift/maps/mp_spawn/main.mdl b/content_skaterift/maps/mp_spawn/main.mdl index 97614c1..c5a0fdc 100644 Binary files a/content_skaterift/maps/mp_spawn/main.mdl and b/content_skaterift/maps/mp_spawn/main.mdl differ diff --git a/content_skaterift/metascenes/battery_intro.ms b/content_skaterift/metascenes/battery_intro.ms new file mode 100644 index 0000000..831d89c Binary files /dev/null and b/content_skaterift/metascenes/battery_intro.ms differ diff --git a/content_skaterift/metascenes/ch2s1.ms b/content_skaterift/metascenes/ch2s1.ms index ac8cef9..5fa2d0a 100644 Binary files a/content_skaterift/metascenes/ch2s1.ms and b/content_skaterift/metascenes/ch2s1.ms differ diff --git a/content_skaterift/metascenes/ch2s4.ms b/content_skaterift/metascenes/ch2s4.ms index deaafcc..8060b61 100644 Binary files a/content_skaterift/metascenes/ch2s4.ms and b/content_skaterift/metascenes/ch2s4.ms differ diff --git a/content_skaterift/metascenes/ch2s6.ms b/content_skaterift/metascenes/ch2s6.ms index 10c50c9..73ed57c 100644 Binary files a/content_skaterift/metascenes/ch2s6.ms and b/content_skaterift/metascenes/ch2s6.ms differ diff --git a/skaterift_blender/sr_main.py b/skaterift_blender/sr_main.py index b982679..c5b31b4 100644 --- a/skaterift_blender/sr_main.py +++ b/skaterift_blender/sr_main.py @@ -369,7 +369,8 @@ class ent_audio(Structure): class ent_marker(Structure): #{ _fields_ = [("transform",mdl_transform), - ("name",c_uint32)] + ("name",c_uint32), + ("flags",c_uint32)] #} class ent_glyph(Structure): diff --git a/skaterift_blender/sr_mdl.py b/skaterift_blender/sr_mdl.py index 2559b4b..f9ac1e3 100644 --- a/skaterift_blender/sr_mdl.py +++ b/skaterift_blender/sr_mdl.py @@ -773,9 +773,11 @@ def _mdl_compiler_compile_entities(): sr_ent_push(volume) #} - elif ent_type == 'ent_marker':#{ + elif ent_type == 'ent_marker': + #{ marker = ent_marker() marker.name = _af_pack_string( obj.SR_data.ent_marker[0].alias ) + marker.flags = obj.SR_data.ent_marker[0].flags compile_obj_transform( obj, marker.transform ) sr_ent_push(marker) #} diff --git a/src/array_file.c b/src/array_file.c index 9bdb590..79a8f82 100644 --- a/src/array_file.c +++ b/src/array_file.c @@ -11,8 +11,7 @@ const char *af_str( array_file_context *af, u32 pstr ) return af->strings + pstr + 4; } -bool af_str_eq( array_file_context *af, u32 pstr, - const char *str, u32 str_hash ) +bool af_str_eq( array_file_context *af, u32 pstr, const char *str, u32 str_hash ) { if( af_str_hash( af, pstr ) == str_hash ) if( !strcmp( str, af_str( af, pstr ))) @@ -21,9 +20,7 @@ bool af_str_eq( array_file_context *af, u32 pstr, return 0; } -static void af_load_array_file_buffer( array_file_context *ctx, - array_file_meta *arr, - void *buffer, u32 stride ) +static void af_load_array_file_buffer( array_file_context *ctx, array_file_meta *arr, void *buffer, u32 stride ) { if( arr->item_count ) { diff --git a/src/entity.h b/src/entity.h index e1aceef..fbc1c9e 100644 --- a/src/entity.h +++ b/src/entity.h @@ -362,9 +362,17 @@ struct ent_audio{ max_channels; }; -struct ent_marker{ +enum +{ + k_ent_marker_flag_hidden = 0x1, + k_ent_marker_flag_gui_icon = 0x8 +}; + +struct ent_marker +{ mdl_transform transform; u32 pstr_alias; + u32 flags; }; enum skateshop_type{ diff --git a/src/metascene.c b/src/metascene.c index c18b4df..afe277f 100644 --- a/src/metascene.c +++ b/src/metascene.c @@ -310,8 +310,7 @@ static void cutscene_load_thread( void *data ) for( u32 k=0; kclip_count; k++ ) { - ent_audio_clip *clip = af_arritm( &_cutscene.meta.audio_clips, - audio->clip_start+k ); + ent_audio_clip *clip = af_arritm( &_cutscene.meta.audio_clips, audio->clip_start+k ); if( clip->_.file.pack_size ) { @@ -319,8 +318,7 @@ static void cutscene_load_thread( void *data ) } else { - clip->_.clip.path = af_str( &_cutscene.meta.af, - clip->_.file.pstr_path ); + clip->_.clip.path = af_str( &_cutscene.meta.af, clip->_.file.pstr_path ); clip->_.clip.flags = audio->flags; clip->_.clip.any_data = NULL; clip->_.clip.size = 0; diff --git a/src/scripts/city.c b/src/scripts/city.c new file mode 100644 index 0000000..378b0f5 --- /dev/null +++ b/src/scripts/city.c @@ -0,0 +1,98 @@ +static bool _skaterift_script_ch3s1( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "j1", KCOL_JOHN "Ohh this is it guys." }, + { "j2", KCOL_JOHN "Good enough!" }, + { "m1", KCOL_MIKE "Never even thought I'd visit the USA" }, + { "m2", KCOL_MIKE "But here we are I guess.." }, + { "j3", KCOL_JOHN "I've had weirder sundays." }, + { "m3", KCOL_MIKE "Somehow I'm not surprised." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch3s1.ms", + .freeze_player = 1, + .subtitles = EN, + }; + generic_cutscene_wrapper( &cutscene, event ); + + if( on_nugget_once( event, "ch3s1_view" ) ) + { + play_generic_cutscene( event ); + } + + return 1; +} + +static bool _skaterift_script_ch3s2( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "m1", KCOL_MIKE "Is that the FBI??" }, + { "m2", KCOL_MIKE "I don't know about this man things are getting weird." }, + { "m3", KCOL_MIKE "Oh no that is not good" }, + { "m4", KCOL_MIKE "What do they even want with him?" }, + { "m5", KCOL_MIKE "Ahhh yeah, the aliens. That'l do it." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch3s2.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch3s2_view", 0, event ); + return 1; +} + +static bool _skaterift_script_ch3s3( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "p1", KCOL_PRES "Yall have some explaining to do here.." }, + { "p2", KCOL_PRES "Every single power plant in the USA is currently offline" }, + { "p3", KCOL_PRES "And yet.." }, + { "p4", KCOL_PRES "There is no national emergency?" }, + { "p5", KCOL_PRES "Nothing is wrong!" }, + { "p6", KCOL_PRES "So where the hell is all this power coming from?" }, + { "p7", KCOL_PRES "We traced it back here, to you guys" }, + { "p8", KCOL_PRES "Now, please. Enlighten me." }, + { "p9", KCOL_PRES "How exactly are you powering all of America?" }, + { "p10", KCOL_PRES "From this one tiny establishment?" }, + { "m1", KCOL_MIKE "Look, this is gonna be a tough one to explain mate" }, + { "m2", KCOL_MIKE "And to be honest I don't really get it myself" }, + { "p11", KCOL_PRES "Do your best!" }, + { "m3", KCOL_MIKE "Mr. President, we saw you take JC," }, + { "m4", KCOL_MIKE "Didn't he explain it to you already?" }, + { "p12", KCOL_PRES "JC JC.." }, + { "p13", KCOL_PRES "Ah! John Cockroach.." }, + { "p14", KCOL_PRES "Of course. He's a friend of yours?" }, + { "m5", KCOL_MIKE "Yeah.. I'm an intern at his wood company." }, + { "m6", KCOL_MIKE "And this is just a friend of ours here." }, + { "p15", KCOL_PRES "So what you're telling me is, and what he told me is," }, + { "p16", KCOL_PRES "Three random people, from a wood company," }, + { "p17", KCOL_PRES "in Tasmania, Australia" }, + { "p18", KCOL_PRES "just happen to have nuclear fusion" }, + { "m7", KCOL_MIKE "Yeah I guess.." }, + { "p19", KCOL_PRES "Man I cannot believe that old guy was telling the truth this whole time" }, + { "m8", KCOL_MIKE "Thats what I've been saying!" }, + { "p20", KCOL_PRES "The world don't make sense any more" }, + { "p21", KCOL_PRES "Well! Fortunately for you lot," }, + { "p22", KCOL_PRES "you're coming with us!" }, + { "p23", KCOL_PRES "We're sending you to Cambodia." }, + { "m9", KCOL_MIKE "What!?" }, + { "m10", KCOL_MIKE "Can he even do that?" }, + { "p24", KCOL_PRES "Yes I can. Now, get in." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch3s3.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch3s3_view", 0, event ); + return 1; +} diff --git a/src/scripts/heaven.c b/src/scripts/heaven.c index ced45be..5b78eec 100644 --- a/src/scripts/heaven.c +++ b/src/scripts/heaven.c @@ -15,7 +15,7 @@ static bool _skaterift_script_intro( ent_script_event *event ) .freeze_player = 1, .subtitles = EN, }; - enum generic_cutscene_event cs_event = optional_video_wrapper( &cutscene, "intro_view", event ); + enum generic_cutscene_event cs_event = optional_video_wrapper( &cutscene, "intro_view", 0, event ); u64 viewed; if( on_nugget_changed( event, "intro_view", &viewed ) ) diff --git a/src/scripts/mtzero.c b/src/scripts/mtzero.c new file mode 100644 index 0000000..7cd46a4 --- /dev/null +++ b/src/scripts/mtzero.c @@ -0,0 +1,364 @@ +static bool _skaterift_script_ch2s1( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "j1", KCOL_JOHN "Eughhh boy" }, + { "j2", KCOL_JOHN "When we get off this thing I gotta go lay down for a bit" }, + { "j3", KCOL_JOHN "Oh look" }, + { "j4", KCOL_JOHN "There's Mike over there" }, + { "j5", KCOL_JOHN "HELLO MIKE!" }, + { "j7", KCOL_JOHN "Yeah listen.." }, + { "j8", KCOL_JOHN "I know things are a bit weird at the moment" }, + { "j9", KCOL_JOHN "but it'l make sense soon" }, + { "j10", KCOL_JOHN "I garuntee it" }, + { "j11", KCOL_JOHN "50%% probably garuntee it" }, + { "j12", KCOL_JOHN "I need you to go on, keep on setting some time trials here" }, + { "j13", KCOL_JOHN "We're gonna need your speed later" }, + { "j14", KCOL_JOHN "Its.. Why I picked you." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s1.ms", + .freeze_player = 1, + .subtitles = EN, + }; + generic_cutscene_wrapper( &cutscene, event ); + + if( on_nugget_once( event, "ch2s1_view" ) ) + { + play_generic_cutscene( event ); + } + + return 1; +} + +static bool _skaterift_script_ch2s2( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "m1", KCOL_MIKE "Haha!" }, + { "m2", KCOL_MIKE "Usually you don't put up with JC's nonsense.." }, + { "m3", KCOL_MIKE "He's been banging on about how we need to set some kind of speed record" }, + { "m4", KCOL_MIKE "For his.. \"Experiment\"" }, + { "m5", KCOL_MIKE "To be honest..." }, + { "m6", KCOL_MIKE "I'm just pretending to go along with it at this point.." }, + { "m7", KCOL_MIKE "I don't want to loose my internship at the wood place.." }, + { "m7b", KCOL_MIKE "He is my boss after all" }, + { "m9", KCOL_MIKE "Anyway uh, speaking of" }, + { "m10", KCOL_MIKE "I gotta go take care of yet another catastrophe he's created back there." }, + { "m11", KCOL_MIKE "I won't go into it." }, + { "m12", KCOL_MIKE "But umm" }, + { "m13", KCOL_MIKE "Good to see you back again" }, + { "m14", KCOL_MIKE "Later." }, + + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s2.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch2s2_view", 0, event ); + return 1; +} + +static bool _skaterift_script_first_mtzero( ent_script_event *event ) +{ + if( on_function_trigger( event, 6 ) ) + { + u64 status = _skaterift_script_nugget_status( "ch2s3_view" ); + if( status == 0 ) + { + _skaterift_script_nugget_set( "ch2s3_view", 2 ); + } + } + + return 1; +} + +static bool _skaterift_script_ch2s3( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "m1", KCOL_MIKE "Holy! You actually bothered to do these?" }, + { "m2", KCOL_MIKE "I mean.." }, + { "m3", KCOL_MIKE "JC's gonna be over the moon obviously, but" }, + { "m4", KCOL_MIKE "Why?" }, + { "m5", KCOL_MIKE "Don't you think its.. pointless?" }, + { "m6", KCOL_MIKE "Myeah I'm heading back to the shop" }, + { "m7", KCOL_MIKE "Coming?" }, + { "m8", KCOL_MIKE "Ohh man.." }, + { "m9", KCOL_MIKE "What a **** racket" }, + { "m10", KCOL_MIKE "It's 8pm even." }, + { "j1", KCOL_JOHN "You guys can't be walking in and scaring me like that" }, + { "m11", KCOL_MIKE "John, " }, + { "m12", KCOL_MIKE "Whats that?" }, + { "j2", KCOL_JOHN "uhhh just uh just uhh" }, + { "j3", KCOL_JOHN "just cleaning something up for a client" }, + { "m13", KCOL_MIKE "A 20ft tall quaterpipe" }, + { "m14", KCOL_MIKE "for a client.." }, + { "m15", KCOL_MIKE "on an island full of pensioners?" }, + { "j4", KCOL_JOHN "Yeah why not?" }, + { "j5", KCOL_JOHN "Skating's taking off right now!" }, + { "m16", KCOL_MIKE "Come on mate.." }, + { "j6", KCOL_JOHN "Aight look.." }, + { "j7", KCOL_JOHN "I'm just skimming little bits from the surplus" }, + { "j8", KCOL_JOHN "I got this plan right." }, + { "j9", KCOL_JOHN "It's gonna be BIG" }, + { "j10", KCOL_JOHN "People from all over the world are gonna come to see it." }, + { "j11", KCOL_JOHN "You know how like uh..." }, + { "j12", KCOL_JOHN "You know how no one visits the west island?" }, + { "m17", KCOL_MIKE "Well.. yeah?" }, + { "j13", KCOL_JOHN "Behold!" }, + { "j14", KCOL_JOHN "Mango mega island!" }, + { "j15", KCOL_JOHN "A skaters dream.." }, + { "m18", KCOL_MIKE "Ohhh yeah john" }, + { "m19", KCOL_MIKE "Looks great!" }, + { "m20", KCOL_MIKE "And whos gonna build this.." }, + { "m21", KCOL_MIKE "gigantic skate thing then..?" }, + { "j16", KCOL_JOHN "Well uhhh" }, + { "j17", KCOL_JOHN "Thats where I need your guys help." }, + { "m22", KCOL_MIKE "What are we gonna help with exactly?" }, + { "m23", KCOL_MIKE "You always do this John." }, + { "m24", KCOL_MIKE "Have some grand idea and suddenly everyones onboard with it." }, + { "j18", KCOL_JOHN "Whens the last time I asked you for anything?" }, + { "m25", KCOL_MIKE "Yesterday.." }, + { "j19", KCOL_JOHN "Oh..." }, + { "j20", KCOL_JOHN "Yeah, anyway" }, + { "j21", KCOL_JOHN "All I need is for you guys to finish the time trials" }, + { "j22", KCOL_JOHN "Go work on those, and come back when you've got it." }, + { "m26", KCOL_MIKE "Yeah well I got news for you!" }, + { "m27", KCOL_MIKE "Bird here has smashed all of them already." }, + { "j23", KCOL_JOHN "wait what?" }, + { "j24", KCOL_JOHN "You did!?" }, + { "j25", KCOL_JOHN "really???" }, + { "j26", KCOL_JOHN "Holy I knew you were good!" }, + { "m28", KCOL_MIKE "Yeah but uhh.." }, + { "m29", KCOL_MIKE "What exactly does this have to do with building a world record size skatepark island?" }, + { "j27", KCOL_JOHN "You see.." }, + { "j28", KCOL_JOHN "It was the missing component. It was speed." }, + { "j29", KCOL_JOHN "It's all we needed, to build a time net" }, + { "j30", KCOL_JOHN "Large enough to create infinite energy." }, + { "m30", KCOL_MIKE "Infinite.. energy..?" }, + { "j31", KCOL_JOHN "Yeah! You know to uh contact Allen and Alvin." }, + { "j32", KCOL_JOHN "They're the ones who are gonna help us with this whole thing." }, + { "m31", KCOL_MIKE "Them! Ahhh no man" }, + { "m32", KCOL_MIKE "not the aliens again.." }, + { "m33", KCOL_MIKE "the tiny little dudes you saw in a drug induced coma" }, + { "m34", KCOL_MIKE "are gonna help us build a megapark, on an abandoned island" }, + { "m35", KCOL_MIKE "I dont even know why I asked.." }, + { "m36", KCOL_MIKE "I'm clocking out. See you later." }, + { "j33", KCOL_JOHN "Look..." }, + { "j34", KCOL_JOHN "I'm not crazy, I promise. Just trust me." }, + { "j35", KCOL_JOHN "Lemme prove it." }, + { "j36", KCOL_JOHN "Bring this with you, hold onto it." }, + { "j37", KCOL_JOHN "Skate those trails as fast as you can with it on you." }, + { "j38", KCOL_JOHN "You'll understand when it happens," }, + { "j39", KCOL_JOHN "And you'll see what I mean by that" }, + { "j40", KCOL_JOHN "You'll just see it.. and" }, + { "j41", KCOL_JOHN "If anyone asks, you didn't get this from me." }, + { "j42", KCOL_JOHN "But I'll be there, I'll be watching, just get on with it." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s3a.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch2s3_view", 2, event ); + + /* TODO: Unlocking the blocker thing here, for the final challenge */ + + return 1; +} + +static bool _skaterift_script_ch2s4( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "j1", KCOL_JOHN "Oh my god.." }, + { "j2", KCOL_JOHN "You **** did it now" }, + { "j3", KCOL_JOHN "I told you I am not crazy!" }, + { "j4", KCOL_JOHN "You've done me a real solid mate." }, + { "j5", KCOL_JOHN "When I switch this thing on" }, + { "j6", KCOL_JOHN "It's gonna broadcast our location to them.." }, + { "j7", KCOL_JOHN "We have just enough power. Thanks to you my friend" }, + { "j8", KCOL_JOHN "Okayyy any second" }, + { "j9", KCOL_JOHN "BOSH" }, + { "j10", KCOL_JOHN "HELLO MY FRIENDS" }, + { "j11", KCOL_JOHN "WE NEED HELP" }, + { "j12", KCOL_JOHN "THIS IS CAPTAIN JOHN COCROACH" }, + { "j13", KCOL_JOHN "PLEASE COME AS SOON AS YOU CAN TO MT.ZERO ISLAND" }, + { "j14", KCOL_JOHN "Our coordinates are...." }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s4.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch2s4_view", 2, event ); + return 1; +} + +static bool _skaterift_script_ch2s5_before( ent_script_event *event ) +{ + u64 status; + if( on_nugget_changed( event, "ch2s5_view", &status ) ) + { + bool visible = 0; + + if( status == 2 ) + visible = 1; + + ent_list_set_visible( event->world, event->entity_list, visible ); + } + + if( on_function_trigger( event, 0 ) ) + { + /* TODO: Move this to a loop */ + if( vg_loader_availible() ) + { + _skaterift_script_nugget_set( "ch2s5_view", 3 ); + skaterift_load_world_command( 1, (const char *[]){ "reload" } ); + } + } + + return 1; +} + +static bool _skaterift_script_ch2s5_after( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "m1", KCOL_MIKE "Hi mate, hows it goin?" }, + { "m2", KCOL_MIKE "Yeah yeah.. I get you.. um." }, + { "m3", KCOL_MIKE "I genuinely have no idea where he found that cell thing" }, + { "m4", KCOL_MIKE "I reckon it came of some kind of secret government tech or whatever" }, + { "m5", KCOL_MIKE "but.." }, + { "m6", KCOL_MIKE "Now you know what he was doing with all those stupid poles he put up across the island" }, + { "m7", KCOL_MIKE "I'm starting to think I might be going crazy but.." }, + { "m8", KCOL_MIKE "Did you see the whole west side has actually been taken over?" }, + { "m9", KCOL_MIKE "Just like JC was saying.." }, + { "m10", KCOL_MIKE "Are you telling me the aliens are actually real?" }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s5.ms", + .freeze_player = 1, + .subtitles = EN, + }; + + enum generic_cutscene_event cs_event = generic_cutscene_wrapper( &cutscene, event ); + + u64 status; + if( on_nugget_changed( event, "ch2s5_view", &status ) ) + { + if( status == 3 ) + { + _skaterift_script_nugget_set( "ch2s5_view", 1 ); + play_generic_cutscene( event ); + } + } + + return 1; +} + +static bool _skaterift_script_ch2s6( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "j1", KCOL_JOHN "Ello guys" }, + { "j2", KCOL_JOHN "Bout time you showed up" }, + { "j3", KCOL_JOHN "Look who I've got here!" }, + { "m1", KCOL_MIKE "Uhhhhhhhhhhhhhhhhhhhhhhhhhhh" }, + { "m2", KCOL_MIKE "Right then." }, + { "m3", KCOL_MIKE "I almost feel bad for these guys" }, + { "m4", KCOL_MIKE "Couldve' been any scientist across the planet" }, + { "m5", KCOL_MIKE "you know actually smart people" }, + { "m6", KCOL_MIKE "but no.." }, + { "m7", KCOL_MIKE "JC somehow contacts them first" }, + { "j4", KCOL_JOHN "Heyyy man." }, + { "j5", KCOL_JOHN "This required a special kind of science" }, + { "j6", KCOL_JOHN "The kinda stuff the world isn't quite ready for yet." }, + { "j7", KCOL_JOHN "But if you're done insulting me.." }, + { "j8", KCOL_JOHN "We're off to the states for a bit." }, + { "j9", KCOL_JOHN "Fancy a road trip?" }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2s6.ms", + .freeze_player = 1, + .subtitles = EN, + }; + enum generic_cutscene_event cs_event = optional_video_wrapper( &cutscene, "ch2s6_view", 2, event ); + + if( cs_event == k_generic_cutscene_event_end ) + { + _skaterift_script_nugget_set( "unlock_city", 1 ); + skaterift_load_world_command( 1, (const char *[]){ "sr002-local-mp_spawn" } ); + } + return 1; +} + +static bool _skaterift_script_ch2e1( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = + { + { "j1", KCOL_JOHN "Hey bird I'm just working on some boards here." }, + { "j2", KCOL_JOHN "If you wanna give me a graphic," }, + { "j3", KCOL_JOHN "I'll print it onto this plywood and press it" }, + { "j4", KCOL_JOHN "Mike'l griptape it and seal it" }, + { "j5", KCOL_JOHN "Ready to sell and skate!" }, + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/ch2e1.ms", + .freeze_player = 1, + .subtitles = EN, + }; + optional_video_wrapper( &cutscene, "ch2e1_view", 2, event ); + return 1; +} + +static bool _skaterift_script_battery_jump( ent_script_event *event ) +{ + static const struct cs_subtitle EN[] = { + { NULL, NULL }, + }; + static const struct generic_cutscene cutscene = + { + .metascene_path = "metascenes/battery_intro.ms", + .freeze_player = 1, + .subtitles = EN, + }; + challenge_video_wrapper( &cutscene, "battery_jump_view", event ); + + if( on_function_trigger( event, 7 ) ) + { + // TODO + vg_error( "WHY????????????\n" ); + } + + if( on_cutscene_marker( event, "$break" ) ) + { + _explode_template_boom( event ); + } + + if( event->type == k_escript_event_world_start ) + { + u32 status = _skaterift_script_nugget_status( "battery_jump_view" ); + + if( status == 1 ) + ent_list_set_visible( event->world, event->entity_list, 0 ); + } + + return 1; +} diff --git a/src/scripts/tutorial_island.c b/src/scripts/tutorial_island.c index b433411..7b4e0ec 100644 --- a/src/scripts/tutorial_island.c +++ b/src/scripts/tutorial_island.c @@ -115,7 +115,7 @@ static bool _skaterift_script_ch1s4( ent_script_event *event ) .freeze_player = 1, .subtitles = EN, }; - optional_video_wrapper( &cutscene, "ch1s4_view", event ); + optional_video_wrapper( &cutscene, "ch1s4_view", 0, event ); return 1; } @@ -184,7 +184,7 @@ static bool _skaterift_script_ch1s6a( ent_script_event *event ) .freeze_player = 1, .subtitles = EN, }; - enum generic_cutscene_event cs_event = optional_video_wrapper( &cutscene, "ch1s6a_view", event ); + enum generic_cutscene_event cs_event = optional_video_wrapper( &cutscene, "ch1s6a_view", 0, event ); if( cs_event == k_generic_cutscene_event_start ) { diff --git a/src/skaterift.c b/src/skaterift.c index 020171c..7a9f745 100644 --- a/src/skaterift.c +++ b/src/skaterift.c @@ -138,6 +138,8 @@ void game_load(void) vg_warn( "Falling back to default hub world...\n" ); _world.loader_reg = _world.default_hub_addon; } + + _world_loader_set_target_reg( _world.loader_reg ); world_switcher_thread( NULL ); vg_async_stall(); diff --git a/src/skaterift_script.c b/src/skaterift_script.c index 939c023..0ed9e47 100644 --- a/src/skaterift_script.c +++ b/src/skaterift_script.c @@ -38,803 +38,6 @@ static bool _skaterift_script_tutorial_setup( enum escript_event ev, const char return 0; } -static bool _skaterift_script_ch2s1( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "j1", KCOL_JOHN "Eughhh boy" }, - { "j2", KCOL_JOHN "When we get off this thing I gotta go lay down for a bit" }, - { "j3", KCOL_JOHN "Oh look" }, - { "j4", KCOL_JOHN "There's Mike over there" }, - { "j5", KCOL_JOHN "HELLO MIKE!" }, - { "j7", KCOL_JOHN "Yeah listen.." }, - { "j8", KCOL_JOHN "I know things are a bit weird at the moment" }, - { "j9", KCOL_JOHN "but it'l make sense soon" }, - { "j10", KCOL_JOHN "I garuntee it" }, - { "j11", KCOL_JOHN "50%% probably garuntee it" }, - { "j12", KCOL_JOHN "I need you to go on, keep on setting some time trials here" }, - { "j13", KCOL_JOHN "We're gonna need your speed later" }, - { "j14", KCOL_JOHN "Its.. Why I picked you." }, - - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s1.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2s2( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "m1", KCOL_MIKE "Haha!" }, - { "m2", KCOL_MIKE "Usually you don't put up with JC's nonsense.." }, - { "m3", KCOL_MIKE "He's been banging on about how we need to set some kind of speed record" }, - { "m4", KCOL_MIKE "For his.. \"Experiment\"" }, - { "m5", KCOL_MIKE "To be honest..." }, - { "m6", KCOL_MIKE "I'm just pretending to go along with it at this point.." }, - { "m7", KCOL_MIKE "I don't want to loose my internship at the wood place.." }, - { "m7b", KCOL_MIKE "He is my boss after all" }, - { "m9", KCOL_MIKE "Anyway uh, speaking of" }, - { "m10", KCOL_MIKE "I gotta go take care of yet another catastrophe he's created back there." }, - { "m11", KCOL_MIKE "I won't go into it." }, - { "m12", KCOL_MIKE "But umm" }, - { "m13", KCOL_MIKE "Good to see you back again" }, - { "m14", KCOL_MIKE "Later." }, - - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s2.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2s3a( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "m1", KCOL_MIKE "Holy! You actually bothered to do these?" }, - { "m2", KCOL_MIKE "I mean.." }, - { "m3", KCOL_MIKE "JC's gonna be over the moon obviously, but" }, - { "m4", KCOL_MIKE "Why?" }, - { "m5", KCOL_MIKE "Don't you think its.. pointless?" }, - { "m6", KCOL_MIKE "Myeah I'm heading back to the shop" }, - { "m7", KCOL_MIKE "Coming?" }, - { "m8", KCOL_MIKE "Ohh man.." }, - { "m9", KCOL_MIKE "What a **** racket" }, - { "m10", KCOL_MIKE "It's 8pm even." }, - { "j1", KCOL_JOHN "You guys can't be walking in and scaring me like that" }, - { "m11", KCOL_MIKE "John, " }, - { "m12", KCOL_MIKE "Whats that?" }, - { "j2", KCOL_JOHN "uhhh just uh just uhh" }, - { "j3", KCOL_JOHN "just cleaning something up for a client" }, - { "m13", KCOL_MIKE "A 20ft tall quaterpipe" }, - { "m14", KCOL_MIKE "for a client.." }, - { "m15", KCOL_MIKE "on an island full of pensioners?" }, - { "j4", KCOL_JOHN "Yeah why not?" }, - { "j5", KCOL_JOHN "Skating's taking off right now!" }, - { "m16", KCOL_MIKE "Come on mate.." }, - { "j6", KCOL_JOHN "Aight look.." }, - { "j7", KCOL_JOHN "I'm just skimming little bits from the surplus" }, - { "j8", KCOL_JOHN "I got this plan right." }, - { "j9", KCOL_JOHN "It's gonna be BIG" }, - { "j10", KCOL_JOHN "People from all over the world are gonna come to see it." }, - { "j11", KCOL_JOHN "You know how like uh..." }, - { "j12", KCOL_JOHN "You know how no one visits the west island?" }, - { "m17", KCOL_MIKE "Well.. yeah?" }, - { "j13", KCOL_JOHN "Behold!" }, - { "j14", KCOL_JOHN "Mango mega island!" }, - { "j15", KCOL_JOHN "A skaters dream.." }, - { "m18", KCOL_MIKE "Ohhh yeah john" }, - { "m19", KCOL_MIKE "Looks great!" }, - { "m20", KCOL_MIKE "And whos gonna build this.." }, - { "m21", KCOL_MIKE "gigantic skate thing then..?" }, - { "j16", KCOL_JOHN "Well uhhh" }, - { "j17", KCOL_JOHN "Thats where I need your guys help." }, - { "m22", KCOL_MIKE "What are we gonna help with exactly?" }, - { "m23", KCOL_MIKE "You always do this John." }, - { "m24", KCOL_MIKE "Have some grand idea and suddenly everyones onboard with it." }, - { "j18", KCOL_JOHN "Whens the last time I asked you for anything?" }, - { "m25", KCOL_MIKE "Yesterday.." }, - { "j19", KCOL_JOHN "Oh..." }, - { "j20", KCOL_JOHN "Yeah, anyway" }, - { "j21", KCOL_JOHN "All I need is for you guys to finish the time trials" }, - { "j22", KCOL_JOHN "Go work on those, and come back when you've got it." }, - { "m26", KCOL_MIKE "Yeah well I got news for you!" }, - { "m27", KCOL_MIKE "Bird here has smashed all of them already." }, - { "j23", KCOL_JOHN "wait what?" }, - { "j24", KCOL_JOHN "You did!?" }, - { "j25", KCOL_JOHN "really???" }, - { "j26", KCOL_JOHN "Holy I knew you were good!" }, - { "m28", KCOL_MIKE "Yeah but uhh.." }, - { "m29", KCOL_MIKE "What exactly does this have to do with building a world record size skatepark island?" }, - { "j27", KCOL_JOHN "You see.." }, - { "j28", KCOL_JOHN "It was the missing component. It was speed." }, - { "j29", KCOL_JOHN "It's all we needed, to build a time net" }, - { "j30", KCOL_JOHN "Large enough to create infinite energy." }, - { "m30", KCOL_MIKE "Infinite.. energy..?" }, - { "j31", KCOL_JOHN "Yeah! You know to uh contact Allen and Alvin." }, - { "j32", KCOL_JOHN "They're the ones who are gonna help us with this whole thing." }, - { "m31", KCOL_MIKE "Them! Ahhh no man" }, - { "m32", KCOL_MIKE "not the aliens again.." }, - { "m33", KCOL_MIKE "the tiny little dudes you saw in a drug induced coma" }, - { "m34", KCOL_MIKE "are gonna help us build a megapark, on an abandoned island" }, - { "m35", KCOL_MIKE "I dont even know why I asked.." }, - { "m36", KCOL_MIKE "I'm clocking out. See you later." }, - { "j33", KCOL_JOHN "Look..." }, - { "j34", KCOL_JOHN "I'm not crazy, I promise. Just trust me." }, - { "j35", KCOL_JOHN "Lemme prove it." }, - { "j36", KCOL_JOHN "Bring this with you, hold onto it." }, - { "j37", KCOL_JOHN "Skate those trails as fast as you can with it on you." }, - { "j38", KCOL_JOHN "You'll understand when it happens," }, - { "j39", KCOL_JOHN "And you'll see what I mean by that" }, - { "j40", KCOL_JOHN "You'll just see it.. and" }, - { "j41", KCOL_JOHN "If anyone asks, you didn't get this from me." }, - { "j42", KCOL_JOHN "But I'll be there, I'll be watching, just get on with it." }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s3a.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2s4( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "j1", KCOL_JOHN "Oh my god.." }, - { "j2", KCOL_JOHN "You **** did it now" }, - { "j3", KCOL_JOHN "I told you I am not crazy!" }, - { "j4", KCOL_JOHN "You've done me a real solid mate." }, - { "j5", KCOL_JOHN "When I switch this thing on" }, - { "j6", KCOL_JOHN "It's gonna broadcast our location to them.." }, - { "j7", KCOL_JOHN "We have just enough power. Thanks to you my friend" }, - { "j8", KCOL_JOHN "Okayyy any second" }, - { "j9", KCOL_JOHN "BOSH" }, - { "j10", KCOL_JOHN "HELLO MY FRIENDS" }, - { "j11", KCOL_JOHN "WE NEED HELP" }, - { "j12", KCOL_JOHN "THIS IS CAPTAIN JOHN COCROACH" }, - { "j13", KCOL_JOHN "PLEASE COME AS SOON AS YOU CAN TO MT.ZERO ISLAND" }, - { "j14", KCOL_JOHN "Our coordinates are...." }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s4.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2e1( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "j1", KCOL_JOHN "Hey bird I'm just working on some boards here." }, - { "j2", KCOL_JOHN "If you wanna give me a graphic," }, - { "j3", KCOL_JOHN "I'll print it onto this plywood and press it" }, - { "j4", KCOL_JOHN "Mike'l griptape it and seal it" }, - { "j5", KCOL_JOHN "Ready to sell and skate!" }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2e1.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2s5( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "m1", KCOL_MIKE "Hi mate, hows it goin?" }, - { "m2", KCOL_MIKE "Yeah yeah.. I get you.. um." }, - { "m3", KCOL_MIKE "I genuinely have no idea where he found that cell thing" }, - { "m4", KCOL_MIKE "I reckon it came of some kind of secret government tech or whatever" }, - { "m5", KCOL_MIKE "but.." }, - { "m6", KCOL_MIKE "Now you know what he was doing with all those stupid poles he put up across the island" }, - { "m7", KCOL_MIKE "I'm starting to think I might be going crazy but.." }, - { "m8", KCOL_MIKE "Did you see the whole west side has actually been taken over?" }, - { "m9", KCOL_MIKE "Just like JC was saying.." }, - { "m10", KCOL_MIKE "Are you telling me the aliens are actually real?" }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s5.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch2s6( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "j1", KCOL_JOHN "Ello guys" }, - { "j2", KCOL_JOHN "Bout time you showed up" }, - { "j3", KCOL_JOHN "Look who I've got here!" }, - { "m1", KCOL_MIKE "Uhhhhhhhhhhhhhhhhhhhhhhhhhhh" }, - { "m2", KCOL_MIKE "Right then." }, - { "m3", KCOL_MIKE "I almost feel bad for these guys" }, - { "m4", KCOL_MIKE "Couldve' been any scientist across the planet" }, - { "m5", KCOL_MIKE "you know actually smart people" }, - { "m6", KCOL_MIKE "but no.." }, - { "m7", KCOL_MIKE "JC somehow contacts them first" }, - { "j4", KCOL_JOHN "Heyyy man." }, - { "j5", KCOL_JOHN "This required a special kind of science" }, - { "j6", KCOL_JOHN "The kinda stuff the world isn't quite ready for yet." }, - { "j7", KCOL_JOHN "But if you're done insulting me.." }, - { "j8", KCOL_JOHN "We're off to the states for a bit." }, - { "j9", KCOL_JOHN "Fancy a road trip?" }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch2s6.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch3s1( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "j1", KCOL_JOHN "Ohh this is it guys." }, - { "j2", KCOL_JOHN "Good enough!" }, - { "m1", KCOL_MIKE "Never even thought I'd visit the USA" }, - { "m2", KCOL_MIKE "But here we are I guess.." }, - { "j3", KCOL_JOHN "I've had weirder sundays." }, - { "m3", KCOL_MIKE "Somehow I'm not surprised." }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch3s1.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch3s2( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "m1", KCOL_MIKE "Is that the FBI??" }, - { "m2", KCOL_MIKE "I don't know about this man things are getting weird." }, - { "m3", KCOL_MIKE "Oh no that is not good" }, - { "m4", KCOL_MIKE "What do they even want with him?" }, - { "m5", KCOL_MIKE "Ahhh yeah, the aliens. That'l do it." }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch3s2.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - -static bool _skaterift_script_ch3s3( enum escript_event ev, const char *inf ) -{ - static u32 state, subtitle_id; - static struct cs_instance *override_inst; - - if( ev == k_escript_event_call ) - { - state = k_escript_state_loading; - override_inst = NULL; - subtitle_id = 0; - vg_info( "test:state = loading\n" ); - } - - if( ev == k_escript_event_cutscene_marker ) - { - struct sr_subtitle EN[] = { - { "p1", KCOL_PRES "Yall have some explaining to do here.." }, - { "p2", KCOL_PRES "Every single power plant in the USA is currently offline" }, - { "p3", KCOL_PRES "And yet.." }, - { "p4", KCOL_PRES "There is no national emergency?" }, - { "p5", KCOL_PRES "Nothing is wrong!" }, - { "p6", KCOL_PRES "So where the hell is all this power coming from?" }, - { "p7", KCOL_PRES "We traced it back here, to you guys" }, - { "p8", KCOL_PRES "Now, please. Enlighten me." }, - { "p9", KCOL_PRES "How exactly are you powering all of America?" }, - { "p10", KCOL_PRES "From this one tiny establishment?" }, - { "m1", KCOL_MIKE "Look, this is gonna be a tough one to explain mate" }, - { "m2", KCOL_MIKE "And to be honest I don't really get it myself" }, - { "p11", KCOL_PRES "Do your best!" }, - { "m3", KCOL_MIKE "Mr. President, we saw you take JC," }, - { "m4", KCOL_MIKE "Didn't he explain it to you already?" }, - { "p12", KCOL_PRES "JC JC.." }, - { "p13", KCOL_PRES "Ah! John Cockroach.." }, - { "p14", KCOL_PRES "Of course. He's a friend of yours?" }, - { "m5", KCOL_MIKE "Yeah.. I'm an intern at his wood company." }, - { "m6", KCOL_MIKE "And this is just a friend of ours here." }, - { "p15", KCOL_PRES "So what you're telling me is, and what he told me is," }, - { "p16", KCOL_PRES "Three random people, from a wood company," }, - { "p17", KCOL_PRES "in Tasmania, Australia" }, - { "p18", KCOL_PRES "just happen to have nuclear fusion" }, - { "m7", KCOL_MIKE "Yeah I guess.." }, - { "p19", KCOL_PRES "Man I cannot believe that old guy was telling the truth this whole time" }, - { "m8", KCOL_MIKE "Thats what I've been saying!" }, - { "p20", KCOL_PRES "The world don't make sense any more" }, - { "p21", KCOL_PRES "Well! Fortunately for you lot," }, - { "p22", KCOL_PRES "you're coming with us!" }, - { "p23", KCOL_PRES "We're sending you to Cambodia." }, - { "m9", KCOL_MIKE "What!?" }, - { "m10", KCOL_MIKE "Can he even do that?" }, - { "p24", KCOL_PRES "Yes I can. Now, get in." }, - { NULL, NULL }, - }; - _skaterift_dialogue( EN, &subtitle_id, inf ); - - return 0; - } - - /* scene - * --------------------------------------------------------------- */ - - if( state == k_escript_state_loading ) - { - if( cmd_cutscene_load( 1, (const char *[]){ "metascenes/ch3s3.ms" } ) ) - { - state = k_escript_state_initializing; - vg_info( "test:state = initializing\n" ); - } - } - - if( state == k_escript_state_initializing ) - { - if( _cutscene.state == k_cutscene_state_ready ) - { - _skaterift_script_bind_player(); - state = k_escript_state_playing; - vg_info( "test:state = playing\n" ); - _cutscene_play(); - } - } - - if( state == k_escript_state_playing ) - { - if( _cutscene.state == k_cutscene_state_done ) - { - state = k_escript_state_end; - vg_info( "test:state = end\n" ); - _cutscene_unload(); - return 1; - } - } - - return 0; -} - static bool _skaterift_script_ch4s1a( enum escript_event ev, const char *inf ) { static u32 state, subtitle_id; @@ -1227,93 +430,6 @@ static bool _skaterift_script_test( enum escript_event ev, const char *inf ) return 0; } -struct -{ - enum escript_script_id active_scripts[ MAX_ACTIVE_SCRIPTS ]; - u32 active_script_count; -} -static _script = { .script_id = k_escript_script_id_max }; -static struct script_info _script_infos[] = -{ - [k_escript_script_id_test] = { "test", _skaterift_script_test }, - [k_escript_script_id_intro] = { "intro", _skaterift_script_intro, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s2] = { "ch1s2", _skaterift_script_ch1s2, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s3] = { "ch1s3", _skaterift_script_ch1s3, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s3b] = {"ch1s3b",_skaterift_script_ch1s3b, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s4] = { "ch1s4", _skaterift_script_ch1s4, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s5] = { "ch1s5", _skaterift_script_ch1s5, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch1s6a] = {"ch1s6a",_skaterift_script_ch1s6a, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s1] = { "ch2s1", _skaterift_script_ch2s1, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s2] = { "ch2s2", _skaterift_script_ch2s2, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s3a] = {"ch2s3a",_skaterift_script_ch2s3a, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s4] = { "ch2s4", _skaterift_script_ch2s4, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2e1] = { "ch2e1", _skaterift_script_ch2e1, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s5] = { "ch2s5", _skaterift_script_ch2s5, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch2s6] = { "ch2s6", _skaterift_script_ch2s6, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch3s1] = { "ch3s1", _skaterift_script_ch3s1, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch3s2] = { "ch3s2", _skaterift_script_ch3s2, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch3s3] = { "ch3s3", _skaterift_script_ch3s3, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch4s1a]= { "ch4s1a",_skaterift_script_ch4s1a, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch4s1] = { "ch4s1", _skaterift_script_ch4s1, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch4s2] = { "ch4s2", _skaterift_script_ch4s2, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_ch4s3] = { "ch4s3", _skaterift_script_ch4s3, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_hub_setup] = { "hub_setup", _skaterift_script_hub_setup }, - [k_escript_script_id_hub_guide] = { "hub_guide", _skaterift_script_hub_guide, SCRIPT_FLAG_STORY_EVENT }, - [k_escript_script_id_tutorial_setup ] = { "tutorial_setup", _skaterift_script_tutorial_setup }, -}; - -bool _skaterift_script_check_unlocked( enum escript_script_id id ) -{ - struct script_info *info = &_script_infos[ id ]; - return info->availible; -} - -bool _skaterift_script_already_viewed( enum escript_script_id id ) -{ - struct script_info *info = &_script_infos[ id ]; - return info->viewed_time? 1: 0; -} - -struct script_info *skaterift_script_get_info( const char *alias ) -{ - for( u32 i=0; iflags &= ~((u32)k_ent_volume_flag_disabled); else volume->flags |= (u32)k_ent_volume_flag_disabled; } + else if( type == k_ent_marker ) + { + ent_marker *marker = af_arritm( &world->ent_marker, index ); + if( visible ) marker->flags &= ~((u32)k_ent_marker_flag_hidden); + else marker->flags |= (u32)k_ent_marker_flag_hidden; + } } } @@ -1518,7 +640,7 @@ bool on_nugget_once( ent_script_event *event, const char *nugget_alias ) { if( event->type != k_escript_event_allocate ) { - if( _skaterift_script_nugget_status( nugget_alias ) == 0 ) + if( _skaterift_script_nugget_status( nugget_alias ) != 1 ) { _skaterift_script_nugget_set( nugget_alias, 1 ); return 1; @@ -1530,14 +652,15 @@ bool on_nugget_once( ent_script_event *event, const char *nugget_alias ) enum generic_cutscene_event optional_video_wrapper( const struct generic_cutscene *cutscene_template, const char *nugget_alias, + u64 nugget_visible_value, ent_script_event *event ) { enum generic_cutscene_event cs_event = generic_cutscene_wrapper( cutscene_template, event ); - u64 viewed; - if( on_nugget_changed( event, nugget_alias, &viewed ) ) + u64 status; + if( on_nugget_changed( event, nugget_alias, &status ) ) { - ent_list_set_visible( event->world, event->entity_list, !viewed ); + ent_list_set_visible( event->world, event->entity_list, status == nugget_visible_value ); } if( on_function_trigger( event, 0 ) ) @@ -1572,6 +695,8 @@ enum generic_cutscene_event challenge_video_wrapper( const struct generic_cutsce #include "scripts/heaven.c" #include "scripts/hub.c" #include "scripts/tutorial_island.c" +#include "scripts/mtzero.c" +#include "scripts/city.c" /* -------------------------------------------------------------------------------------------------------------------- * function aliasing @@ -1592,9 +717,23 @@ struct ent_script_table_entry _ent_script_table[] = { "final_portal", _skaterift_script_final_portal }, { "unlock_mtzero", _skaterift_script_unlock_mtzero }, + { "ch2s1", _skaterift_script_ch2s1 }, + { "ch2s2", _skaterift_script_ch2s2 }, + { "first_mtzero", _skaterift_script_first_mtzero }, + { "ch2s3", _skaterift_script_ch2s3 }, + { "ch2s4", _skaterift_script_ch2s4 }, + { "battery_jump", _skaterift_script_battery_jump }, + { "ch2s5_before", _skaterift_script_ch2s5_before }, + { "ch2s5_after", _skaterift_script_ch2s5_after }, + { "ch2s6", _skaterift_script_ch2s6 }, + { "ch2e1", _skaterift_script_ch2e1 }, + { "unlock_city", _skaterift_script_unlock_city }, - { "unlock_valley", _skaterift_script_unlock_valley }, + { "ch3s1", _skaterift_script_ch3s1 }, + { "ch3s2", _skaterift_script_ch3s2 }, + { "ch3s3", _skaterift_script_ch3s3 }, + { "unlock_valley", _skaterift_script_unlock_valley }, { NULL } }; @@ -1625,9 +764,20 @@ _skaterift_script_savedata[] = { "unlock_mtzero" }, { "unlock_mtzero_view" }, + { "ch2s1_view" }, + { "ch2s2_view" }, + { "ch2s3_view" }, + { "battery_jump_view" }, + { "ch2s4_view" }, + { "ch2s5_view" }, /* is the trigger for the second map */ + { "ch2s6_view" }, + { "ch2e1_view" }, { "unlock_city" }, { "unlock_city_view" }, + { "ch3s1_view" }, + { "ch3s2_view" }, + { "ch3s3_view" }, { "unlock_valley" }, { "unlock_valley_view" }, diff --git a/src/world.h b/src/world.h index 5342289..7b8a288 100644 --- a/src/world.h +++ b/src/world.h @@ -255,6 +255,7 @@ struct world_static world_instance *loader_instance; void *loader_heap; bool loader_preview_mode; + char loader_filename[64]; enum world_event { diff --git a/src/world_load.c b/src/world_load.c index 0e2ec62..0b0e0b7 100644 --- a/src/world_load.c +++ b/src/world_load.c @@ -286,7 +286,7 @@ void skaterift_world_load_thread( void *_ ) if( strcmp(ext,".mdl") ) continue; - if( !strcmp( d_name, "main.mdl" ) ) + if( !strcmp( d_name, _world.loader_filename ) ) { found_any_mdl = 1; found_main_mdl = 1; @@ -309,8 +309,8 @@ void skaterift_world_load_thread( void *_ ) { if( !found_main_mdl ) { - vg_warn( "World model file is not called 'main.mdl'\n" - "Path: %s\n", mdl_path ); + vg_warn( "World model file is not called '%s'\n" + "Path: %s\n", _world.loader_filename, mdl_path ); } } else @@ -508,10 +508,27 @@ void skaterift_load_world_start( addon_reg *reg, bool preview ) vg_audio_fadeout_flagged_audio( AUDIO_FLAG_WORLD, 1.0f ); } - _world.loader_reg = reg; _world.loader_instance = world; _world.loader_heap = preview? _world.preview_heap: _world.heap; _world.loader_preview_mode = preview; + _world_loader_set_target_reg( reg ); +} + +void _world_loader_set_target_reg( addon_reg *reg ) +{ + strcpy( _world.loader_filename, "main.mdl" ); + _world.loader_reg = reg; + if( reg->flags & ADDON_REG_MTZERO ) + { + u64 status = _skaterift_script_nugget_status( "ch2s5_view" ); + + /* we've seen the cutscene already (1), or about to play it on world load (3). + * both of those statuses mean we load 'main'. */ + if( !( status == 1 || status == 3 ) ) + { + strcpy( _world.loader_filename, "before.mdl" ); + } + } } /* console command for the above function */ @@ -531,14 +548,10 @@ int skaterift_load_world_command( int argc, const char *argv[] ) return 0; } - bool preview = 0; - + const char *override = NULL; if( argc >= 2 ) { - if( !strcmp( argv[1], "preview" ) ) - { - preview = 1; - } + override = argv[1]; } addon_alias q; @@ -549,7 +562,7 @@ int skaterift_load_world_command( int argc, const char *argv[] ) { addon_reg *reg = get_addon_from_index( k_addon_type_world, reg_id, 0,0 ); menu_on_world_change( reg ); - skaterift_load_world_start( reg, preview ); + skaterift_load_world_start( reg, 0 ); } else { diff --git a/src/world_load.h b/src/world_load.h index f175bd2..361ce37 100644 --- a/src/world_load.h +++ b/src/world_load.h @@ -6,6 +6,7 @@ int skaterift_load_world_command( int argc, const char *argv[] ); void skaterift_load_world_start( addon_reg *reg, bool preview_mode ); +void _world_loader_set_target_reg( addon_reg *reg ); void world_switcher_update(void); void world_switcher_thread( void *_ ); void world_instance_free_graphics_data( world_instance *world ); diff --git a/src/world_map.c b/src/world_map.c index c316fad..d8ee256 100644 --- a/src/world_map.c +++ b/src/world_map.c @@ -225,28 +225,21 @@ void render_world_map(void) continue; enum gui_icon icon = k_gui_icon_exclaim_2d; - if( challenge->flags & k_ent_challenge_is_story ) - { - icon = k_gui_icon_story2d; -#if 0 - if( world->events[i].story_script ) - { - if( world->events[i].story_script->viewed_time ) - { - icon = k_gui_icon_story_done2d; - } - } -#endif - } - else - { - if( challenge->status ) - icon = k_gui_icon_tick_2d; - } - + if( challenge->status ) + icon = k_gui_icon_tick_2d; respawn_map_draw_icon( &world_map.final_cam, icon, challenge->transform.co, 1.0f ); } + for( u32 i=0; ient_marker); i ++ ) + { + ent_marker *marker = af_arritm( &world->ent_marker, i ); + if( marker->flags & k_ent_marker_flag_hidden ) + continue; + + if( marker->flags & k_ent_marker_flag_gui_icon ) + respawn_map_draw_icon( &world_map.final_cam, k_gui_icon_story2d, marker->transform.co, 1.0f ); + } + for( u32 i=0; ient_spawn); i ++ ) { ent_spawn *spawn = af_arritm( &world->ent_spawn, i );