taisei/src/plrmodes.h
Andrei Alexeyev 80fda75ffb
Dialogue updates with dynamic facial expressions and defeated character portraits (#175)
* WIP portrait faces

* character expressions for dialogue in first 3 stages (wip)

* dialog: simplified face system, new faces, script revisions (wip)

* fix wrong face name in reimu script

* cirno angry face; elly beaten variant

* render_character_portrait(): fix garbage bg and filter-bleeding

* workaround for incorrect face blending on dialog fade

* render_character_portrait(): fix bogus debug labels

* Replace sprite offsets with the more powerful paddings

* new faces for youmu, wriggle, kurumi; dialogue updates

* fix release build

* Update portraits; add Iku faces and Elly shouting face

* Add Reimu sigh face and Marisa sweat_smile face

* Add Kurumi dissatisfied face

* update Hina
2019-08-22 22:43:34 +03:00

125 lines
3.7 KiB
C

/*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#ifndef IGUARD_plrmodes_h
#define IGUARD_plrmodes_h
#include "taisei.h"
#include "enemy.h"
#include "projectile.h"
#include "player.h"
#include "ending.h"
#include "stage.h"
#include "dialog.h"
typedef enum {
// WARNING: Reordering this will break current replays, and possibly even progress files.
PLR_CHAR_REIMU = 0,
PLR_CHAR_MARISA = 1,
PLR_CHAR_YOUMU = 2,
NUM_CHARACTERS,
} CharacterID;
typedef enum {
// WARNING: Reordering this will break current replays, and possibly even progress files.
PLR_SHOT_A,
PLR_SHOT_B,
NUM_SHOT_MODES_PER_CHARACTER,
PLR_SHOT_MARISA_LASER = PLR_SHOT_A,
PLR_SHOT_MARISA_STAR = PLR_SHOT_B,
PLR_SHOT_YOUMU_MIRROR = PLR_SHOT_A,
PLR_SHOT_YOUMU_HAUNTING = PLR_SHOT_B,
PLR_SHOT_REIMU_SPIRIT = PLR_SHOT_A,
PLR_SHOT_REIMU_DREAM = PLR_SHOT_B,
} ShotModeID;
typedef enum {
// vpu = viewport units
PLR_PROP_SPEED, // current player movement speed (vpu/frame)
PLR_PROP_POC, // "point of collection" boundary: all items are auto-collected when player is above this (vpu)
PLR_PROP_COLLECT_RADIUS, // how near the player has to be to an item before it's auto-collected (vpu)
PLR_PROP_BOMB_TIME, // how long a bomb should last if it were to activate this frame; 0 prevents activation (frames)
PLR_PROP_DEATHBOMB_WINDOW, // how much time the player has to recover with a bomb if they died in this frame (frames)
} PlrProperty;
typedef void (*PlrCharEndingProc)(Ending *e);
typedef struct PlayerCharacter {
CharacterID id;
const char *lower_name;
const char *proper_name;
const char *full_name;
const char *title;
const char *dialog_base_sprite_name;
const char *player_sprite_name;
const char *menu_texture_name;
struct {
PlrCharEndingProc good;
PlrCharEndingProc bad;
} ending;
} PlayerCharacter;
typedef void (*PlayerModeInitProc)(Player *plr);
typedef void (*PlayerModeFreeProc)(Player *plr);
typedef void (*PlayerModeThinkProc)(Player *plr);
typedef void (*PlayerModeShotProc)(Player *plr);
typedef void (*PlayerModeBombProc)(Player *plr);
typedef void (*PlayerModeBombBgProc)(Player *plr);
typedef void (*PlayerModePowerProc)(Player *plr, short npow);
typedef void (*PlayerModePreloadProc)(void);
typedef double (*PlayerModePropertyProc)(Player *plr, PlrProperty prop);
typedef struct PlayerMode {
const char *name;
const char *description;
const char *spellcard_name;
PlayerCharacter *character;
PlayerDialogProcs *dialog;
ShotModeID shot_mode;
struct {
PlayerModeInitProc init;
PlayerModeFreeProc free;
PlayerModeThinkProc think;
PlayerModeShotProc shot;
PlayerModeBombProc bomb;
ShaderRule bomb_shader;
PlayerModeBombBgProc bombbg;
PlayerModePowerProc power;
PlayerModePreloadProc preload;
PlayerModePropertyProc property;
} procs;
} PlayerMode;
enum {
NUM_PLAYER_MODES = NUM_CHARACTERS * NUM_SHOT_MODES_PER_CHARACTER,
};
PlayerCharacter* plrchar_get(CharacterID id);
void plrchar_preload(PlayerCharacter *pc);
void plrchar_make_bomb_portrait(PlayerCharacter *pc, Sprite *out_spr);
int plrchar_face_spritename(PlayerCharacter *pc, const char *face, char *buf, size_t bufsize);
Sprite *plrchar_face_sprite(PlayerCharacter *pc, const char *face);
PlayerMode* plrmode_find(CharacterID charid, ShotModeID shotid);
int plrmode_repr(char *out, size_t outsize, PlayerMode *mode, bool internal);
PlayerMode* plrmode_parse(const char *name);
void plrmode_preload(PlayerMode *mode);
double player_property(Player *plr, PlrProperty prop);
#endif // IGUARD_plrmodes_h