refactor dialog selection logic

This commit is contained in:
Andrei Alexeyev 2018-07-15 18:48:22 +03:00
parent 5e711b2abb
commit a0eadef8c0
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
22 changed files with 184 additions and 319 deletions

View file

@ -55,3 +55,20 @@ void draw_dialog(Dialog *dialog)
bool page_dialog(Dialog **d) attr_nonnull(1);
void process_dialog(Dialog **d) attr_nonnull(1);
// FIXME: might not be the best place for this
typedef struct PlayerDialogProcs {
void (*stage1_pre_boss)(Dialog *d);
void (*stage1_post_boss)(Dialog *d);
void (*stage2_pre_boss)(Dialog *d);
void (*stage2_post_boss)(Dialog *d);
void (*stage3_pre_boss)(Dialog *d);
void (*stage3_post_boss)(Dialog *d);
void (*stage4_pre_boss)(Dialog *d);
void (*stage4_post_boss)(Dialog *d);
void (*stage5_post_midboss)(Dialog *d);
void (*stage5_pre_boss)(Dialog *d);
void (*stage5_post_boss)(Dialog *d);
void (*stage6_pre_boss)(Dialog *d);
void (*stage6_pre_final)(Dialog *d);
} PlayerDialogProcs;

View file

@ -1,13 +0,0 @@
/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
*/
#pragma once
#include "taisei.h"
#include "youmu.h"
#include "marisa.h"

View file

@ -12,7 +12,7 @@
#define M(side,message) dadd_msg(d,side,message)
void dialog_marisa_stage1(Dialog *d) {
static void dialog_marisa_stage1_pre_boss(Dialog *d) {
M(Left, "Its gotten pretty cold round here. I wish I brought a sweater.");
M(Right, "Every time theres an incident, we fairies show up to stop weak humans like you from spoiling the fun!");
M(Left, "So, youre callin me weak?");
@ -20,12 +20,12 @@ void dialog_marisa_stage1(Dialog *d) {
M(Left, "Id like to see ya try.");
}
void dialog_marisa_stage1_post(Dialog *d) {
static void dialog_marisa_stage1_post_boss(Dialog *d) {
M(Right, "Waah, its hot! Im gonna melt!");
M(Left, "Ive made the lake a lot warmer now, so ya cant freeze anyone.");
}
void dialog_marisa_stage2(Dialog *d) {
static void dialog_marisa_stage2_pre_boss(Dialog *d) {
M(Right, "I cant let you pass any further than this. Please go back down the mountain.");
M(Left, "So, is that your misfortune talkin?");
M(Right, "Exploring that tunnel is only going to lead you to ruin. Ill protect you by driving you away!");
@ -33,13 +33,13 @@ void dialog_marisa_stage2(Dialog *d) {
M(Right, "A bad attitude like that is destined to be cursed from the beginning. Ill send you packing home as a favor to you, so you dont get hurt further by your terrible ideas!");
}
void dialog_marisa_stage2_post(Dialog *d) {
static void dialog_marisa_stage2_post_boss(Dialog *d) {
M(Left, "Somehow I already feel luckier after beating ya. Fixin the border should be no sweat!");
M(Right, "Its as much as I can do since I cannot stop you. But maybe you could reconsider…?");
M(Left, "Nope! Im way too excited!");
}
void dialog_marisa_stage3(Dialog *d) {
static void dialog_marisa_stage3_pre_boss(Dialog *d) {
M(Left, "Huh, didnt expect a bug to make it this far down the tunnel.");
M(Right, "All of this beautiful light, and you didnt expect me to be drawn to it?");
M(Left, "I expected ya to lose, thats all.");
@ -49,7 +49,7 @@ void dialog_marisa_stage3(Dialog *d) {
M(Right, "Ha! Watch me put on a grand light show that will put your dud fireworks to shame!");
}
void dialog_marisa_stage3_post(Dialog *d) {
static void dialog_marisa_stage3_post_boss(Dialog *d) {
M(Left, "So wheres the finale? Nothings changed.");
M(Right, "I was lying! I just wanted to take you down a peg with my new magic!");
M(Left, "Yknow, fly too close to the sun and ya get burned. Ill be goin to take care of some real threats now.");
@ -57,7 +57,7 @@ void dialog_marisa_stage3_post(Dialog *d) {
M(Left, "Yeah, yeah. Youll need to be less crispy first, though.");
}
void dialog_marisa_stage4(Dialog *d) {
static void dialog_marisa_stage4_pre_boss(Dialog *d) {
M(Right, "Halt, intruder!");
M(Left, "Now heres a face I havent seen in a long time. Whats this fancy house all about anyways? Decided to guard Yūka again, or is it somebody new?");
M(Right, "Its none of your business, thats what it is. My friend is busy with some important work and she cant be disturbed by nosy humans poking into where they dont belong.");
@ -66,7 +66,7 @@ void dialog_marisa_stage4(Dialog *d) {
M(Left, "Shoot, so thats a no to my reservation, right?");
}
void dialog_marisa_stage4_post(Dialog *d) {
static void dialog_marisa_stage4_post_boss(Dialog *d) {
M(Right, "Oh no, I lost! Shell be really angry if someone interferes with her preparations!");
M(Left, "Right, got any tickets left then? Ill probably be a little early, but I wanna meet the star of this show.");
M(Left, "She seems like somebody Id know.");
@ -74,7 +74,7 @@ void dialog_marisa_stage4_post(Dialog *d) {
M(Left, "Now thats what I like t hear!");
}
void dialog_marisa_stage5(Dialog *d) {
static void dialog_marisa_stage5_pre_boss(Dialog *d) {
M(Left, "I finally caught up to ya! I shouldve known that the Dragons messenger would be hard to chase down in the air.");
M(Left, "Are you part of the incident too?");
M(Right, "Werent those earlier bombs enough of a deterrent? As this world is cutting into the space of Heaven, only those authorized are allowed to investigate.");
@ -85,13 +85,12 @@ void dialog_marisa_stage5(Dialog *d) {
M(Right, "Prepare to be struck down from Heavens door!");
}
void dialog_marisa_stage5_mid(Dialog *d) {
static void dialog_marisa_stage5_post_midboss(Dialog *d) {
// this dialog must contain only one page
M(Left, "Hey, wait! …Did I just see an oarfish?");
}
void dialog_marisa_stage5_post(Dialog *d) {
static void dialog_marisa_stage5_post_boss(Dialog *d) {
M(Right, "You weathered my assault well. It is unconventional, but Ill let you take care of this.");
M(Left, "Ha, Im always fixin problems back home. Ive got all the right credentials!");
M(Right, "…Im going to get into so much trouble, arent I?");
@ -100,7 +99,7 @@ void dialog_marisa_stage5_post(Dialog *d) {
M(Left, "No guarantees!");
}
void dialog_marisa_stage6(Dialog *d) {
static void dialog_marisa_stage6_pre_boss(Dialog *d) {
M(Left, "And so the big bad boss behind it all is…");
M(Left, "Wait, Elly?!");
M(Right, "Thats strange; I thought Kurumi was keeping people from sneaking into my research facility.");
@ -112,11 +111,26 @@ void dialog_marisa_stage6(Dialog *d) {
M(Right, "An unenlightened fool like you wouldnt understand… Youre even still using magic, of all things!");
M(Left, "I understand enough to know that youre the problem. And like any good mathematician, Im gonna solve it by blastin it to bits!");
M(Right, "No! Youll never destroy my lifes work! Ill dissect that nonsensical magic of yours, and then Ill tear it apart!");
}
void dialog_marisa_stage6_inter(Dialog *d) {
static void dialog_marisa_stage6_pre_final(Dialog *d) {
M(Right, "Youve gotten this far… I cant believe it! But that will not matter once I show you the truth of this world, and every world.");
M(Right, "Space, time, dimensions… it all becomes clear when you understand The Theory of Everything!");
M(Right, "Prepare to see the barrier destroyed!");
}
PlayerDialogProcs dialog_marisa = {
.stage1_pre_boss = dialog_marisa_stage1_pre_boss,
.stage1_post_boss = dialog_marisa_stage1_post_boss,
.stage2_pre_boss = dialog_marisa_stage2_pre_boss,
.stage2_post_boss = dialog_marisa_stage2_post_boss,
.stage3_pre_boss = dialog_marisa_stage3_pre_boss,
.stage3_post_boss = dialog_marisa_stage3_post_boss,
.stage4_pre_boss = dialog_marisa_stage4_pre_boss,
.stage4_post_boss = dialog_marisa_stage4_post_boss,
.stage5_post_midboss = dialog_marisa_stage5_post_midboss,
.stage5_pre_boss = dialog_marisa_stage5_pre_boss,
.stage5_post_boss = dialog_marisa_stage5_post_boss,
.stage6_pre_boss = dialog_marisa_stage6_pre_boss,
.stage6_pre_final = dialog_marisa_stage6_pre_final,
};

View file

@ -11,16 +11,4 @@
#include "dialog.h"
void dialog_marisa_stage1(Dialog *d);
void dialog_marisa_stage1_post(Dialog *d);
void dialog_marisa_stage2(Dialog *d);
void dialog_marisa_stage2_post(Dialog *d);
void dialog_marisa_stage3(Dialog *d);
void dialog_marisa_stage3_post(Dialog *d);
void dialog_marisa_stage4(Dialog *d);
void dialog_marisa_stage4_post(Dialog *d);
void dialog_marisa_stage5(Dialog *d);
void dialog_marisa_stage5_mid(Dialog *d);
void dialog_marisa_stage5_post(Dialog *d);
void dialog_marisa_stage6(Dialog *d);
void dialog_marisa_stage6_inter(Dialog *d);
extern PlayerDialogProcs dialog_marisa;

View file

@ -9,11 +9,10 @@
#include "taisei.h"
#include "reimu.h"
#include "dialog.h"
#define M(side,message) dadd_msg(d,side,message)
void dialog_reimu_stage1(Dialog *d) {
static void dialog_reimu_stage1_pre_boss(Dialog *d) {
M(Left, "Good grief, its too early in the morning to be flying around.");
M(Right, "Hey, shrine maiden! Am I making you cold?");
M(Left, "Not as much as youre just being a pest. Im too busy to play games with fairies.");
@ -21,11 +20,11 @@ void dialog_reimu_stage1(Dialog *d) {
M(Right, "Prepare to catch an air conditioner cold on my ice playground!");
}
void dialog_reimu_stage1_post(Dialog *d) {
static void dialog_reimu_stage1_post_boss(Dialog *d) {
M(Left, "A~ah, its snowing during springtime. Its actually a bit pretty to look at.");
}
void dialog_reimu_stage2(Dialog *d) {
static void dialog_reimu_stage2_pre_boss(Dialog *d) {
M(Right, "I cant let you pass any further than this. Please go back down the mountain.");
M(Left, "You help humans that wander around the mountain, dont you? So why are you getting in the way?");
M(Right, "I can feel misfortune leaking from this tunnel. You wont be going anywhere safe down this route so I need to stop you!");
@ -33,14 +32,14 @@ void dialog_reimu_stage2(Dialog *d) {
M(Right, "Im afraid not!");
}
void dialog_reimu_stage2_post(Dialog *d) {
static void dialog_reimu_stage2_post_boss(Dialog *d) {
M(Left, "In the end, you only made things harder for the both of us.");
M(Right, "Im sorry, Miss Shrine Maiden! Would you like a blessing to make up for it?");
M(Left, "No need. Im the luckiest person in Gensokyo, at least when its not about money.");
M(Left, "If you want to help, donate to my shrine. I dont care if its cursed.");
}
void dialog_reimu_stage3(Dialog *d) {
static void dialog_reimu_stage3_pre_boss(Dialog *d) {
M(Left, "Huh, a bug that managed to escape extermination.");
M(Right, "I heard that! ");
M(Right, "Do you really think Ill let you get away with such a callous remark?");
@ -50,7 +49,7 @@ void dialog_reimu_stage3(Dialog *d) {
M(Right, "Im drunk on power! Ill prove my mettle by defeating you once and for all!");
}
void dialog_reimu_stage3_post(Dialog *d) {
static void dialog_reimu_stage3_post_boss(Dialog *d) {
M(Left, "If humans get drunk from moonshine, then I guess bugs can become intoxicated by sunshine too.");
M(Right, "Ugh, my head hurts. Cant you go easy on me?");
M(Left, "I dont go easy on anyone that claims to be causing an incident. But I can tell you are lying about that.");
@ -59,7 +58,7 @@ void dialog_reimu_stage3_post(Dialog *d) {
M(Left, "Go take a nap already.");
}
void dialog_reimu_stage4(Dialog *d) {
static void dialog_reimu_stage4_pre_boss(Dialog *d) {
M(Right, "Halt, intruder!");
M(Left, "Oh, its somebody new.");
M(Right, "No, definitely not! I could never forget you from all those years ago! That was the most intense battle of my life!");
@ -69,7 +68,7 @@ void dialog_reimu_stage4(Dialog *d) {
M(Right, "You dont get a choice! Prepare to have bloody nightmares for weeks, shrine maiden!");
}
void dialog_reimu_stage4_post(Dialog *d) {
static void dialog_reimu_stage4_post_boss(Dialog *d) {
M(Left, "See, I dont scare easily, so that didnt work. You should have just told me your name.");
M(Right, "I didnt think it was possible, but youre so much stronger than before!");
M(Right, "Cant you remember? Im Kurumi!");
@ -77,7 +76,7 @@ void dialog_reimu_stage4_post(Dialog *d) {
M(Right, "Waah, so mean! You were way cuter back then!");
}
void dialog_reimu_stage5(Dialog *d) {
static void dialog_reimu_stage5_pre_boss(Dialog *d) {
M(Left, "I didnt expect someone actually respectable like you to cause me trouble for no reason.");
M(Right, "You may be the Hakurei Shrine Maiden, but Im afraid that you dont have permission from Heaven to be here.");
M(Left, "What, are you saying that the gods suddenly dont think Im fit for duty anymore?");
@ -88,18 +87,18 @@ void dialog_reimu_stage5(Dialog *d) {
M(Right, "If you can weather the storm Im about to summon, then Ill be fully confident that you can strike down the master of this tower!");
}
void dialog_reimu_stage5_mid(Dialog *d) {
static void dialog_reimu_stage5_post_midboss(Dialog *d) {
M(Left, "I wonder whats gotten into that oarfish?");
}
void dialog_reimu_stage5_post(Dialog *d) {
static void dialog_reimu_stage5_post_boss(Dialog *d) {
M(Left, "See? Ive been solving incidents since the beginning. There is absolutely no one more qualified than me.");
M(Right, "Youre still as unruly as ever. But you passed, and you certainly hold great power.");
M(Right, "Ill let my superiors know that the Hakurei Shrine Maiden arrived to clear up this issue.");
M(Left, "Right, and Ill make sure it wont take too long. Tell them to hold tight, and maybe slip me some yen later.");
}
void dialog_reimu_stage6(Dialog *d) {
static void dialog_reimu_stage6_pre_boss(Dialog *d) {
M(Left, "Who are you? Youre a lot less intimidating than I expected.");
M(Right, "I knew you would come here to interrupt me.");
M(Left, "You seem to know who I am, just like that earlier yōkai did. I cant say the same for myself.");
@ -113,9 +112,24 @@ void dialog_reimu_stage6(Dialog *d) {
M(Right, "Youll regret threatening my lifes work when I take your world away. Soon you will be a shrine maiden of nothing!");
}
void dialog_reimu_stage6_inter(Dialog *d) {
static void dialog_reimu_stage6_pre_final(Dialog *d) {
M(Right, "Youve gotten this far… I cant believe it! But that will not matter once I show you the truth of this world, and every world.");
M(Right, "Space, time, dimensions… it all becomes clear when you understand The Theory of Everything!");
M(Right, "Prepare to see the barrier destroyed!");
}
PlayerDialogProcs dialog_reimu = {
.stage1_pre_boss = dialog_reimu_stage1_pre_boss,
.stage1_post_boss = dialog_reimu_stage1_post_boss,
.stage2_pre_boss = dialog_reimu_stage2_pre_boss,
.stage2_post_boss = dialog_reimu_stage2_post_boss,
.stage3_pre_boss = dialog_reimu_stage3_pre_boss,
.stage3_post_boss = dialog_reimu_stage3_post_boss,
.stage4_pre_boss = dialog_reimu_stage4_pre_boss,
.stage4_post_boss = dialog_reimu_stage4_post_boss,
.stage5_post_midboss = dialog_reimu_stage5_post_midboss,
.stage5_pre_boss = dialog_reimu_stage5_pre_boss,
.stage5_post_boss = dialog_reimu_stage5_post_boss,
.stage6_pre_boss = dialog_reimu_stage6_pre_boss,
.stage6_pre_final = dialog_reimu_stage6_pre_final,
};

View file

@ -11,16 +11,4 @@
#include "dialog.h"
void dialog_reimu_stage1(Dialog *d);
void dialog_reimu_stage1_post(Dialog *d);
void dialog_reimu_stage2(Dialog *d);
void dialog_reimu_stage2_post(Dialog *d);
void dialog_reimu_stage3(Dialog *d);
void dialog_reimu_stage3_post(Dialog *d);
void dialog_reimu_stage4(Dialog *d);
void dialog_reimu_stage4_post(Dialog *d);
void dialog_reimu_stage5(Dialog *d);
void dialog_reimu_stage5_mid(Dialog *d);
void dialog_reimu_stage5_post(Dialog *d);
void dialog_reimu_stage6(Dialog *d);
void dialog_reimu_stage6_inter(Dialog *d);
extern PlayerDialogProcs dialog_reimu;

View file

@ -9,11 +9,10 @@
#include "taisei.h"
#include "youmu.h"
#include "dialog.h"
#define M(side,message) dadd_msg(d,side,message)
void dialog_youmu_stage1(Dialog *d) {
static void dialog_youmu_stage1_pre_boss(Dialog *d) {
M(Left, "The temperature of the lake almost resembles the Netherworlds. Good thing I dont get cold easily.");
M(Right, "Whats that? You think you cant get cold?");
M(Left, "I dont just think that, I know that. Im half-phantom, so even my body is cold.");
@ -21,11 +20,11 @@ void dialog_youmu_stage1(Dialog *d) {
M(Right, "Lets see if phantoms are good as soft-serve ice cream!");
}
void dialog_youmu_stage1_post(Dialog *d) {
static void dialog_youmu_stage1_post_boss(Dialog *d) {
M(Left, "Lady Yuyuko would probably like trying such an unusual flavor of ice cream. I hope she never gets that idea.");
}
void dialog_youmu_stage2(Dialog *d) {
static void dialog_youmu_stage2_pre_boss(Dialog *d) {
M(Right, "I cant let you pass any further than this. Please go back down the mountain.");
M(Left, "Are you a goddess? Its nice of you to be looking out for me, but the Netherworld has been put at risk due to this incident.");
M(Left, "I have to keep going.");
@ -33,14 +32,14 @@ void dialog_youmu_stage2(Dialog *d) {
M(Left, "My mistress wont like it if I tell her I was stopped by divine intervention. Youll have to come up with another excuse.");
}
void dialog_youmu_stage2_post(Dialog *d) {
static void dialog_youmu_stage2_post_boss(Dialog *d) {
M(Left, "Its strange, but I feel as if my burdens have been lifted. Did you decide to bless me after all?");
M(Right, "Its the least I can do since I cannot stop you. Are you sure you want to go through the tunnel?");
M(Left, "I dont have a choice. Im being ordered to by a power far beyond us both.");
M(Left, "Shes most definitely stronger than gods when she is angry.");
}
void dialog_youmu_stage3(Dialog *d) {
static void dialog_youmu_stage3_pre_boss(Dialog *d) {
M(Left, "Huh, why is it that I feel like Ive fought you before? But when I try to recall anything, my skin crawls and I seem to forget immediately.");
M(Right, "Maybe its because you realized the true power of us insects?");
M(Left, "No, I think its because I was too disgusted.");
@ -49,7 +48,7 @@ void dialog_youmu_stage3(Dialog *d) {
M(Left, "If I cut legs off of an insect, do they squirm all on their own? How gross!");
}
void dialog_youmu_stage3_post(Dialog *d) {
static void dialog_youmu_stage3_post_boss(Dialog *d) {
M(Right, "I surrender! Please dont chop anything off!");
M(Left, "I suppose that as long as you dont eat anything in my garden, I can let you go.");
M(Right, "I prefer meat, but not when its holding a skewer!");
@ -57,7 +56,7 @@ void dialog_youmu_stage3_post(Dialog *d) {
M(Left, "Im too busy to listen to this buzzing.");
}
void dialog_youmu_stage4(Dialog *d) {
static void dialog_youmu_stage4_pre_boss(Dialog *d) {
M(Right, "Halt, intruder!");
M(Left, "Oh, and who might you be?");
M(Right, "Kuru— Hey, my name isnt important for a nosy person like you to know!");
@ -68,7 +67,7 @@ void dialog_youmu_stage4(Dialog *d) {
M(Right, "I can bet you that Im much more frightening.");
}
void dialog_youmu_stage4_post(Dialog *d) {
static void dialog_youmu_stage4_post_boss(Dialog *d) {
M(Left, "Youre not as scary as her, or even as good of a host.");
M(Left, "Maybe you should work on your manners and buy yourself a nice mansion to lord over instead of taking someone elses.");
M(Right, "I dont care about being a stuffy noble! Just leave my friend alone to do her work!");
@ -76,7 +75,7 @@ void dialog_youmu_stage4_post(Dialog *d) {
M(Right, "…Youre really prim and proper, arent you?");
}
void dialog_youmu_stage5(Dialog *d) {
static void dialog_youmu_stage5_pre_boss(Dialog *d) {
M(Left, "You were quite difficult to pin down. Dont worry; Ill listen to whatever warning you have before I continue forward.");
M(Right, "Hmm, youre the groundskeeper of the Netherworld, correct?");
M(Left, "Thats right. My mistress sent me here to investigate since the world of spirits has been put in jeopardy by this new world infringing on its boundaries.");
@ -86,19 +85,19 @@ void dialog_youmu_stage5(Dialog *d) {
M(Left, "I shall pass whatever test necessary if it will allow me to fulfill the wishes of Lady Yuyuko!");
}
void dialog_youmu_stage5_mid(Dialog *d) {
static void dialog_youmu_stage5_post_midboss(Dialog *d) {
// this dialog must contain only one page
M(Left, "A messenger of Heaven! If I follow her, Ill surely learn something about the incident!");
}
void dialog_youmu_stage5_post(Dialog *d) {
static void dialog_youmu_stage5_post_boss(Dialog *d) {
M(Right, "You cut through the cloudbank, and now the storm has cleared. It is unconventional, but I trust you to end the incident.");
M(Left, "Its a lot on my shoulders, but I must believe in my capacity for the sake of the Netherworld.");
M(Left, "As for you, if the Celestials give you any trouble, Im certain my lady could speak to them on your behalf.");
M(Right, "Thank you. Now hurry, for the barrier is becoming thinner than ever!");
}
void dialog_youmu_stage6(Dialog *d) {
static void dialog_youmu_stage6_pre_boss(Dialog *d) {
M(Left, "Are you the one behind this new world?");
M(Right, "That is correct.");
M(Left, "Considering that scythe of yours, Im really quite surprised that a shikigami would be behind everything.");
@ -112,9 +111,24 @@ void dialog_youmu_stage6(Dialog *d) {
M(Right, "Pitiful servant of the dead. Youll never be able to stop my lifes work from being fulfilled! Ill simply unravel that nonsense behind your half-and-half existence!");
}
void dialog_youmu_stage6_inter(Dialog *d) {
static void dialog_youmu_stage6_pre_final(Dialog *d) {
M(Right, "Youve gotten this far… I cant believe it! But that will not matter once I show you the truth of this world, and every world.");
M(Right, "Space, time, dimensions… it all becomes clear when you understand The Theory of Everything!");
M(Right, "Prepare to see the barrier destroyed!");
}
PlayerDialogProcs dialog_youmu = {
.stage1_pre_boss = dialog_youmu_stage1_pre_boss,
.stage1_post_boss = dialog_youmu_stage1_post_boss,
.stage2_pre_boss = dialog_youmu_stage2_pre_boss,
.stage2_post_boss = dialog_youmu_stage2_post_boss,
.stage3_pre_boss = dialog_youmu_stage3_pre_boss,
.stage3_post_boss = dialog_youmu_stage3_post_boss,
.stage4_pre_boss = dialog_youmu_stage4_pre_boss,
.stage4_post_boss = dialog_youmu_stage4_post_boss,
.stage5_post_midboss = dialog_youmu_stage5_post_midboss,
.stage5_pre_boss = dialog_youmu_stage5_pre_boss,
.stage5_post_boss = dialog_youmu_stage5_post_boss,
.stage6_pre_boss = dialog_youmu_stage6_pre_boss,
.stage6_pre_final = dialog_youmu_stage6_pre_final,
};

View file

@ -11,16 +11,4 @@
#include "dialog.h"
void dialog_youmu_stage1(Dialog *d);
void dialog_youmu_stage1_post(Dialog *d);
void dialog_youmu_stage2(Dialog *d);
void dialog_youmu_stage2_post(Dialog *d);
void dialog_youmu_stage3(Dialog *d);
void dialog_youmu_stage3_post(Dialog *d);
void dialog_youmu_stage4(Dialog *d);
void dialog_youmu_stage4_post(Dialog *d);
void dialog_youmu_stage5(Dialog *d);
void dialog_youmu_stage5_mid(Dialog *d);
void dialog_youmu_stage5_post(Dialog *d);
void dialog_youmu_stage6(Dialog *d);
void dialog_youmu_stage6_inter(Dialog *d);
extern PlayerDialogProcs dialog_youmu;

View file

@ -51,6 +51,8 @@ void player_stage_post_init(Player *plr) {
assert(plr->mode->procs.shot != NULL);
assert(plr->mode->procs.bomb != NULL);
assert(plr->mode->procs.property != NULL);
assert(plr->mode->character != NULL);
assert(plr->mode->dialog != NULL);
delete_enemies(&global.plr.slaves);

View file

@ -14,6 +14,7 @@
#include "player.h"
#include "ending.h"
#include "stage.h"
#include "dialog.h"
typedef enum {
/* do not reorder - screws replays */
@ -79,6 +80,7 @@ typedef double (*PlayerModePropertyProc)(Player *plr, PlrProperty prop);
typedef struct PlayerMode {
const char *name;
PlayerCharacter *character;
PlayerDialogProcs *dialog;
ShotModeID shot_mode;
struct {

View file

@ -12,6 +12,7 @@
#include "plrmodes.h"
#include "marisa_a.h"
#include "marisa_b.h"
#include "dialog/marisa.h"
extern PlayerCharacter character_marisa;

View file

@ -624,6 +624,7 @@ static void marisa_laser_preload(void) {
PlayerMode plrmode_marisa_a = {
.name = "Laser Sign",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_LASER,
.procs = {
.property = marisa_laser_property,

View file

@ -349,6 +349,7 @@ static void marisa_star_preload(void) {
PlayerMode plrmode_marisa_b = {
.name = "Star Sign",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_STAR,
.procs = {
.property = marisa_star_property,

View file

@ -12,10 +12,10 @@
#include "plrmodes.h"
#include "youmu_a.h"
#include "youmu_b.h"
#include "dialog/youmu.h"
extern PlayerCharacter character_youmu;
double youmu_common_property(Player *plr, PlrProperty prop);
void youmu_common_shot(Player *plr);
void youmu_common_draw_proj(Projectile *p, Color c, float scale);

View file

@ -425,6 +425,7 @@ static void youmu_mirror_preload(void) {
PlayerMode plrmode_youmu_a = {
.name = "Mirror Sign",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_MIRROR,
.procs = {
.property = youmu_common_property,

View file

@ -399,6 +399,7 @@ static void youmu_haunting_preload(void) {
PlayerMode plrmode_youmu_b = {
.name = "Haunting Sign",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_HAUNTING,
.procs = {
.property = youmu_common_property,

View file

@ -11,43 +11,19 @@
#include "stage1_events.h"
#include "global.h"
#include "stagetext.h"
#include "dialog/all.h"
Dialog *stage1_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/cirno");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage1(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage1(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage1_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/cirno");
pm->dialog->stage1_pre_boss(d);
dadd_msg(d, BGM, "stage1boss");
return d;
}
static Dialog *stage1_postdialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/cirno");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage1_post(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage1_post(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage1_dialog_post_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/cirno");
pm->dialog->stage1_post_boss(d);
return d;
}
@ -324,7 +300,7 @@ void cirno_intro_boss(Boss *c, int time) {
GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.05);
AT(120)
global.dialog = stage1_dialog();
global.dialog = stage1_dialog_pre_boss();
}
void cirno_iceplosion0(Boss *c, int time) {
@ -1314,7 +1290,7 @@ void stage1_events(void) {
}
AT(5100) {
global.dialog = stage1_postdialog();
global.dialog = stage1_dialog_post_boss();
}
AT(5400 - FADE_TIME) {

View file

@ -12,42 +12,19 @@
#include "global.h"
#include "stage.h"
#include "enemy.h"
#include "dialog/all.h"
Dialog *stage2_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/hina");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage2(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage2(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage2_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/hina");
pm->dialog->stage2_pre_boss(d);
dadd_msg(d, BGM, "stage2boss");
return d;
}
Dialog *stage2_post_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/hina");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage2_post(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage2_post(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage2_dialog_post_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/hina");
pm->dialog->stage2_post_boss(d);
return d;
}
@ -335,7 +312,7 @@ void hina_intro(Boss *h, int time) {
TIMER(&time);
AT(100)
global.dialog = stage2_dialog();
global.dialog = stage2_dialog_pre_boss();
GO_TO(h, VIEWPORT_W/2 + 100.0*I, 0.05);
}
@ -876,7 +853,7 @@ void stage2_events(void) {
}
AT(5180) {
global.dialog = stage2_post_dialog();
global.dialog = stage2_dialog_post_boss();
}
AT(5340 - FADE_TIME) {

View file

@ -12,44 +12,20 @@
#include "global.h"
#include "stage.h"
#include "enemy.h"
#include "dialog/all.h"
static Dialog *stage3_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/wriggle");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage3(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage3(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage3_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/wriggle");
pm->dialog->stage3_pre_boss(d);
dadd_msg(d, BGM, "stage3boss");
return d;
}
static Dialog *stage3_post_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/wriggle");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage3_post(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage3_post(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage3_dialog_post_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/wriggle");
pm->dialog->stage3_post_boss(d);
return d;
}
static int stage3_enterswirl(Enemy *e, int t) {
@ -1347,7 +1323,7 @@ static void stage3_boss_nonspell3(Boss *boss, int time) {
static void stage3_boss_intro(Boss *boss, int time) {
if(time == 110)
global.dialog = stage3_dialog();
global.dialog = stage3_dialog_pre_boss();
GO_TO(boss, VIEWPORT_W/2.0 + 100.0*I, 0.03);
}
@ -1600,8 +1576,9 @@ void stage3_events(void) {
AT(5300 + midboss_time) {
global.boss = stage3_create_boss();
}
AT(5400 + midboss_time) {
global.dialog = stage3_post_dialog();
global.dialog = stage3_dialog_post_boss();
}
AT(5700 + midboss_time - FADE_TIME) {

View file

@ -14,7 +14,6 @@
#include "stage.h"
#include "enemy.h"
#include "laser.h"
#include "dialog/all.h"
void kurumi_spell_bg(Boss*, int);
void kurumi_slaveburst(Boss*, int);
@ -24,40 +23,19 @@ void kurumi_blowwall(Boss*, int);
void kurumi_danmaku(Boss*, int);
void kurumi_extra(Boss*, int);
Dialog *stage4_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/kurumi");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage4(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage4(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage4_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/kurumi");
pm->dialog->stage4_pre_boss(d);
dadd_msg(d, BGM, "stage4boss");
return d;
}
Dialog *stage4_dialog_end(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/kurumi");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage4_post(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage4_post(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage4_dialog_post_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/kurumi");
pm->dialog->stage4_post_boss(d);
dadd_msg(d, BGM, "stage4boss");
return d;
}
@ -558,7 +536,7 @@ void kurumi_boss_intro(Boss *b, int t) {
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.015);
AT(120)
global.dialog = stage4_dialog();
global.dialog = stage4_dialog_pre_boss();
}
static int splitcard_elly(Projectile *p, int t) {
@ -1525,7 +1503,7 @@ void stage4_events(void) {
global.boss = create_kurumi();
AT(5400 + midboss_time)
global.dialog = stage4_dialog_end();
global.dialog = stage4_dialog_post_boss();
AT(5550 + midboss_time - FADE_TIME) {
stage_finish(GAMEOVER_WIN);

View file

@ -11,71 +11,31 @@
#include "stage5_events.h"
#include "stage5.h"
#include "global.h"
#include "dialog/all.h"
Dialog *stage5_post_mid_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, NULL);
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage5_mid(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage5_mid(d);
break;
default:
log_warn("No dialog available for this character.");
}
if(d->count != 1) {
log_fatal("The stage 5 midboss dialog can only contain one line");
}
DialogMessage *m = &d->messages[0];
m->timeout = global.frames + 120;
static Dialog *stage5_dialog_post_midboss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, NULL);
pm->dialog->stage5_post_midboss(d);
assert(d->count == 1);
d->messages->timeout = global.frames + 120;
return d;
}
Dialog *stage5_boss_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/iku");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage5(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage5(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage5_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/iku");
pm->dialog->stage5_pre_boss(d);
dadd_msg(d, BGM, "stage5boss");
return d;
}
Dialog *stage5_post_boss_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/iku");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage5_post(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage5_post(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage5_dialog_post_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/iku");
pm->dialog->stage5_pre_boss(d);
return d;
}
int stage5_greeter(Enemy *e, int t) {
TIMER(&t)
AT(EVENT_KILLED) {
@ -440,7 +400,7 @@ void iku_intro(Boss *b, int t) {
GO_TO(b, VIEWPORT_W/2+240.0*I, 0.015);
if(t == 160)
global.dialog = stage5_boss_dialog();
global.dialog = stage5_dialog_pre_boss();
}
static void cloud_common(void) {
@ -1222,7 +1182,7 @@ void stage5_events(void) {
global.boss = create_iku_mid();
AT(2920) {
global.dialog = stage5_post_mid_dialog();
global.dialog = stage5_dialog_post_midboss();
// XXX: this shitty hack is needed to force the dialog to not reopen immediately when it's closed with the shot button
global.timer++;
@ -1327,7 +1287,7 @@ void stage5_events(void) {
}
AT(6980) {
global.dialog = stage5_post_boss_dialog();
global.dialog = stage5_dialog_post_boss();
}
AT(7210 - FADE_TIME) {

View file

@ -12,41 +12,19 @@
#include "stage6.h"
#include "global.h"
#include "stagetext.h"
#include "dialog/all.h"
Dialog *stage6_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/elly");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage6(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage6(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage6_dialog_pre_boss(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/elly");
pm->dialog->stage6_pre_boss(d);
dadd_msg(d, BGM, "stage6boss_phase1");
return d;
}
static Dialog *stage6_interboss_dialog(void) {
PlayerCharacter *pc = global.plr.mode->character;
Dialog *d = create_dialog(pc->dialog_sprite_name, "dialog/elly");
switch(pc->id) {
case PLR_CHAR_MARISA:
dialog_marisa_stage6_inter(d);
break;
case PLR_CHAR_YOUMU:
dialog_youmu_stage6_inter(d);
break;
default:
log_warn("No dialog available for this character.");
}
static Dialog *stage6_dialog_pre_final(void) {
PlayerMode *pm = global.plr.mode;
Dialog *d = create_dialog(pm->character->dialog_sprite_name, "dialog/elly");
pm->dialog->stage6_pre_final(d);
return d;
}
@ -290,7 +268,7 @@ void elly_intro(Boss *b, int t) {
}
AT(300)
global.dialog = stage6_dialog();
global.dialog = stage6_dialog_pre_boss();
}
int scythe_infinity(Enemy *e, int t) {
@ -2707,7 +2685,7 @@ Boss* stage6_spawn_elly(complex pos) {
}
static void elly_insert_interboss_dialog(Boss *b, int t) {
global.dialog = stage6_interboss_dialog();
global.dialog = stage6_dialog_pre_final();
}
static void elly_begin_toe(Boss *b, int t) {