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.
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* 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 "resource/sprite.h"
|
|
|
|
struct DialogMessage;
|
|
struct DialogSpeaker;
|
|
|
|
typedef enum {
|
|
Right,
|
|
Left,
|
|
BGM
|
|
} Side;
|
|
|
|
typedef struct DialogMessage {
|
|
Side side;
|
|
char *msg;
|
|
int timeout;
|
|
} DialogMessage;
|
|
|
|
typedef struct Dialog {
|
|
DialogMessage *messages;
|
|
Sprite *images[2];
|
|
|
|
int count;
|
|
int pos;
|
|
|
|
int page_time;
|
|
|
|
int birthtime;
|
|
} Dialog;
|
|
|
|
Dialog *create_dialog(const char *left, const char *right)
|
|
attr_returns_nonnull attr_nodiscard;
|
|
|
|
void dset_image(Dialog *d, Side side, const char *name)
|
|
attr_nonnull(1, 3);
|
|
|
|
DialogMessage* dadd_msg(Dialog *d, Side side, const char *msg)
|
|
attr_nonnull(1, 3);
|
|
|
|
void delete_dialog(Dialog *d)
|
|
attr_nonnull(1);
|
|
|
|
void draw_dialog(Dialog *dialog)
|
|
attr_nonnull(1);
|
|
|
|
bool page_dialog(Dialog **d) attr_nonnull(1);
|
|
void process_dialog(Dialog **d) attr_nonnull(1);
|