2011-05-08 13:48:25 +02:00
|
|
|
/*
|
|
|
|
* This software is licensed under the terms of the MIT-License
|
2017-02-11 04:52:08 +01:00
|
|
|
* See COPYING for further information.
|
2011-05-08 13:48:25 +02:00
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2011-05-08 13:48:25 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
#include "dialog.h"
|
|
|
|
#include "global.h"
|
|
|
|
|
2017-10-08 13:30:51 +02:00
|
|
|
Dialog *create_dialog(const char *left, const char *right) {
|
2019-07-03 19:50:43 +02:00
|
|
|
Dialog *d = calloc(1, sizeof(Dialog));
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2018-02-06 07:19:25 +01:00
|
|
|
if(left) {
|
|
|
|
d->images[Left] = get_sprite(left);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(right) {
|
|
|
|
d->images[Right] = get_sprite(right);
|
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
d->page_time = global.frames;
|
|
|
|
d->birthtime = global.frames;
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
static int message_index(Dialog *d, int offset) {
|
|
|
|
int idx = d->pos + offset;
|
|
|
|
|
|
|
|
if(idx >= d->count) {
|
|
|
|
idx = d->count - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(idx >= 0 && d->messages[idx].side == BGM) {
|
|
|
|
--idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
2017-10-08 13:30:51 +02:00
|
|
|
void dset_image(Dialog *d, Side side, const char *name) {
|
2018-02-06 07:19:25 +01:00
|
|
|
d->images[side] = get_sprite(name);
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2017-11-12 18:16:15 +01:00
|
|
|
DialogMessage* dadd_msg(Dialog *d, Side side, const char *msg) {
|
2011-05-08 13:48:25 +02:00
|
|
|
d->messages = realloc(d->messages, (++d->count)*sizeof(DialogMessage));
|
|
|
|
d->messages[d->count-1].side = side;
|
|
|
|
d->messages[d->count-1].msg = malloc(strlen(msg) + 1);
|
2017-11-12 18:16:15 +01:00
|
|
|
d->messages[d->count-1].timeout = 0;
|
2017-02-16 07:29:18 +01:00
|
|
|
strlcpy(d->messages[d->count-1].msg, msg, strlen(msg) + 1);
|
2017-11-12 18:16:15 +01:00
|
|
|
return &d->messages[d->count-1];
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void delete_dialog(Dialog *d) {
|
2019-07-03 19:50:43 +02:00
|
|
|
for(int i = 0; i < d->count; i++) {
|
2011-05-08 13:48:25 +02:00
|
|
|
free(d->messages[i].msg);
|
2019-07-03 19:50:43 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
free(d->messages);
|
|
|
|
free(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw_dialog(Dialog *dialog) {
|
2019-07-03 19:50:43 +02:00
|
|
|
if(dialog == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
float o = dialog->opacity;
|
|
|
|
|
|
|
|
if(o == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r_state_push();
|
|
|
|
r_state_push();
|
|
|
|
r_shader("sprite_default");
|
|
|
|
|
|
|
|
r_mat_push();
|
|
|
|
r_mat_translate(VIEWPORT_X, 0, 0);
|
|
|
|
|
|
|
|
const double dialog_width = VIEWPORT_W * 1.2;
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
r_mat_push();
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_translate(dialog_width/2.0, 64, 0);
|
|
|
|
|
|
|
|
int cur_idx = message_index(dialog, 0);
|
|
|
|
int pre_idx = message_index(dialog, -1);
|
|
|
|
|
|
|
|
assume(cur_idx >= 0);
|
|
|
|
|
|
|
|
int cur_side = dialog->messages[cur_idx].side;
|
|
|
|
int pre_side = pre_idx >= 0 ? dialog->messages[pre_idx].side : 2;
|
|
|
|
|
|
|
|
Color clr = { 0 };
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
const float page_time = 10;
|
|
|
|
float page_alpha = min(global.frames - (dialog->page_time), page_time) / page_time;
|
|
|
|
|
|
|
|
const float page_text_time = 60;
|
|
|
|
float page_text_alpha = min(global.frames - dialog->page_time, page_text_time) / page_text_time;
|
|
|
|
|
|
|
|
int loop_start = 1;
|
|
|
|
int loop_incr = 1;
|
|
|
|
|
|
|
|
if(cur_side == 0) {
|
|
|
|
loop_start = 1;
|
|
|
|
loop_incr = -1;
|
|
|
|
} else {
|
|
|
|
loop_start = 0;
|
|
|
|
loop_incr = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = loop_start; i < 2 && i >= 0; i += loop_incr) {
|
2018-04-12 16:08:48 +02:00
|
|
|
r_mat_push();
|
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
if(i == Left) {
|
2018-04-12 16:08:48 +02:00
|
|
|
r_cull(CULL_FRONT);
|
|
|
|
r_mat_scale(-1, 1, 1);
|
|
|
|
} else {
|
|
|
|
r_cull(CULL_BACK);
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
if(o < 1) {
|
|
|
|
r_mat_translate(120 * (1 - o), 0, 0);
|
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
float dir = (1 - 2 * (i == cur_side));
|
|
|
|
float ofs = 10 * dir;
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
if(page_alpha < 10 && ((i != pre_side && i == cur_side) || (i == pre_side && i != cur_side))) {
|
|
|
|
r_mat_translate(ofs * page_alpha, ofs * page_alpha, 0);
|
|
|
|
float brightness = min(1.0 - 0.7 * page_alpha * dir, 1);
|
|
|
|
clr.r = clr.g = clr.b = brightness;
|
|
|
|
clr.a = 1;
|
2011-05-08 13:48:25 +02:00
|
|
|
} else {
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_translate(ofs, ofs, 0);
|
|
|
|
clr = *RGB(1 - (dir > 0) * 0.7, 1 - (dir > 0) * 0.7, 1 - (dir > 0) * 0.7);
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
color_mul_scalar(&clr, o);
|
|
|
|
r_color(&clr);
|
|
|
|
|
|
|
|
if(dialog->images[i]) {
|
|
|
|
Sprite *s = dialog->images[i];
|
|
|
|
r_mat_translate((dialog_width - s->w)/2 + 32, VIEWPORT_H - s->h/2, 0);
|
|
|
|
draw_sprite_batched_p(0, 0, s);
|
|
|
|
r_state_push();
|
|
|
|
r_shader_standard_notex();
|
|
|
|
r_mat_push();
|
|
|
|
r_mat_scale(s->w, s->h, 1);
|
|
|
|
// r_mat_translate(0.5, 0.5, 0);
|
|
|
|
r_color4(0.2, 0.2, 0.2, 0.2);
|
|
|
|
// r_draw_quad();
|
|
|
|
r_mat_pop();
|
|
|
|
r_state_pop();
|
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_pop();
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
r_mat_pop();
|
2019-07-03 19:50:43 +02:00
|
|
|
r_state_pop();
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
o *= smooth(clamp((global.frames - dialog->birthtime - 10) / 30.0, 0, 1));
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
FloatRect dialog_bg_rect = {
|
|
|
|
.extent = { VIEWPORT_W-40, 110 },
|
|
|
|
.offset = { VIEWPORT_W/2, VIEWPORT_H-55 },
|
|
|
|
};
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_push();
|
|
|
|
if(o < 1) {
|
|
|
|
r_mat_translate(0, 100 * (1 - o), 0);
|
|
|
|
}
|
|
|
|
r_color4(0, 0, 0, 0.8 * o);
|
|
|
|
r_mat_push();
|
|
|
|
r_mat_translate(dialog_bg_rect.x, dialog_bg_rect.y, 0);
|
|
|
|
r_mat_scale(dialog_bg_rect.w, dialog_bg_rect.h, 1);
|
2018-04-12 16:08:48 +02:00
|
|
|
r_shader_standard_notex();
|
|
|
|
r_draw_quad();
|
|
|
|
r_mat_pop();
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
Font *font = get_font("standard");
|
2017-10-23 12:10:40 +02:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_mode(MM_TEXTURE);
|
|
|
|
r_mat_push();
|
|
|
|
// r_mat_scale(2, 0.2, 0);
|
|
|
|
// r_mat_translate(0, -global.frames/page_text_time, 0);
|
|
|
|
r_mat_mode(MM_MODELVIEW);
|
|
|
|
|
|
|
|
dialog_bg_rect.w = VIEWPORT_W * 0.86;
|
|
|
|
dialog_bg_rect.x -= dialog_bg_rect.w * 0.5;
|
|
|
|
dialog_bg_rect.y -= dialog_bg_rect.h * 0.5;
|
|
|
|
// dialog_bg_rect.h = dialog_bg_rect.w;
|
|
|
|
|
|
|
|
if(pre_idx >= 0 && page_text_alpha < 1) {
|
|
|
|
if(pre_side == Right) {
|
|
|
|
clr = *RGB(0.6, 0.6, 1.0);
|
|
|
|
} else {
|
|
|
|
clr = *RGB(1.0, 1.0, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
color_mul_scalar(&clr, o);
|
|
|
|
|
|
|
|
text_draw_wrapped(dialog->messages[pre_idx].msg, VIEWPORT_W * 0.86, &(TextParams) {
|
|
|
|
.shader = "text_dialog",
|
|
|
|
.aux_textures = { get_tex("cell_noise") },
|
|
|
|
.shader_params = &(ShaderCustomParams) {{ o * (1.0 - (0.2 + 0.8 * page_text_alpha)), 1 }},
|
|
|
|
.color = &clr,
|
|
|
|
.pos = { VIEWPORT_W/2, VIEWPORT_H-110 + font_get_lineskip(font) },
|
|
|
|
.align = ALIGN_CENTER,
|
|
|
|
.font_ptr = font,
|
|
|
|
.overlay_projection = &dialog_bg_rect,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cur_side == Right) {
|
|
|
|
clr = *RGB(0.6, 0.6, 1.0);
|
|
|
|
} else {
|
|
|
|
clr = *RGB(1.0, 1.0, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
color_mul_scalar(&clr, o);
|
|
|
|
|
|
|
|
text_draw_wrapped(dialog->messages[cur_idx].msg, VIEWPORT_W * 0.86, &(TextParams) {
|
|
|
|
.shader = "text_dialog",
|
|
|
|
.aux_textures = { get_tex("cell_noise") },
|
|
|
|
.shader_params = &(ShaderCustomParams) {{ o * page_text_alpha, 0 }},
|
|
|
|
.color = &clr,
|
|
|
|
.pos = { VIEWPORT_W/2, VIEWPORT_H-110 + font_get_lineskip(font) },
|
|
|
|
.align = ALIGN_CENTER,
|
|
|
|
.font_ptr = font,
|
|
|
|
.overlay_projection = &dialog_bg_rect,
|
2018-06-29 23:36:51 +02:00
|
|
|
});
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_mode(MM_TEXTURE);
|
|
|
|
r_mat_pop();
|
|
|
|
r_mat_mode(MM_MODELVIEW);
|
2018-04-12 16:08:48 +02:00
|
|
|
|
|
|
|
r_mat_pop();
|
2019-07-03 19:50:43 +02:00
|
|
|
r_mat_pop();
|
|
|
|
r_state_pop();
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2017-11-12 18:16:15 +01:00
|
|
|
bool page_dialog(Dialog **d) {
|
2019-07-03 19:50:43 +02:00
|
|
|
if(!*d || (*d)->pos >= (*d)->count) {
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-11-12 18:16:15 +01:00
|
|
|
int to = (*d)->messages[(*d)->pos].timeout;
|
|
|
|
|
|
|
|
if(to && to > global.frames) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
(*d)->pos++;
|
|
|
|
(*d)->page_time = global.frames;
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
if((*d)->pos >= (*d)->count) {
|
2017-11-12 18:16:15 +01:00
|
|
|
// XXX: maybe this can be handled elsewhere?
|
2012-08-05 21:35:49 +02:00
|
|
|
if(!global.boss)
|
|
|
|
global.timer++;
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
} else if((*d)->messages[(*d)->pos].side == BGM) {
|
|
|
|
stage_start_bgm((*d)->messages[(*d)->pos].msg);
|
|
|
|
return page_dialog(d);
|
2011-05-08 13:48:25 +02:00
|
|
|
}
|
2017-11-12 18:16:15 +01:00
|
|
|
|
|
|
|
return true;
|
2012-08-05 21:35:49 +02:00
|
|
|
}
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
|
|
|
|
void process_dialog(Dialog **d) {
|
|
|
|
if(!*d) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
if(dialog_is_active(*d)) {
|
|
|
|
int to = (*d)->messages[(*d)->pos].timeout;
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
if(
|
|
|
|
(to && to >= global.frames) ||
|
|
|
|
((global.plr.inputflags & INFLAG_SKIP) && global.frames - (*d)->page_time > 3)
|
|
|
|
) {
|
|
|
|
page_dialog(d);
|
|
|
|
}
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
}
|
2019-07-03 19:50:43 +02:00
|
|
|
|
|
|
|
// important to check this again; the page_dialog call may have ended the dialog
|
|
|
|
|
|
|
|
if(dialog_is_active(*d)) {
|
|
|
|
fapproach_asymptotic_p(&(*d)->opacity, 1, 0.05, 1e-3);
|
|
|
|
} else {
|
|
|
|
fapproach_asymptotic_p(&(*d)->opacity, 0, 0.1, 1e-3);
|
|
|
|
if((*d)->opacity == 0) {
|
|
|
|
delete_dialog(*d);
|
|
|
|
*d = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool dialog_is_active(Dialog *d) {
|
|
|
|
return d && (d->pos < d->count);
|
Give projectiles EVENT_BIRTH and call them with t==0 more consistently
The only case of t==0 being skipped is if the projectile was somehow
created after the projectile processing loop for this frame has been
finished. Currently that is only possible if a particle spawns a
non-particle projectile, which, ideally, should never happen. The same
problem exists with other types of entities. For example, if you have a
funny projectile rule that spawns an Enemy, that Enemy will have the 0th
frame skipped. One way to fix this is to maintain a list of all entities
in the game and process them all in a single loop, where newly spawned
entities would be appended to the tail of the list. This is also
probably the only good way to fix this, too.
Handling of all projectile events has been made mandatory to facilitate
easier debugging of subtle and/or hard to track bugs. If t<0, then the
projectile rule MUST return ACTION_ACK, signifying that it acknowledged
the event and handled it appropriately. Otherwise, it SHOULD return
ACTION_NONE or ACTION_DESTROY. In a perfect world, those just wouldn't
be conflated in the same function with update logic.
I've also cleaned up the stage_logic routine a bit. Moved most of the
dialog handling into dialog.c and gave higher priority to boss
processing. The later is currently necessary to let boss-spawned
projectiles and particles to get called with t==0.
2018-05-16 01:38:47 +02:00
|
|
|
}
|