2011-04-10 10:23:24 +02:00
|
|
|
/*
|
2019-08-03 19:43:48 +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-04-10 10:23:24 +02:00
|
|
|
* ---
|
2024-05-16 23:30:41 +02:00
|
|
|
* Copyright (c) 2011-2024, Lukas Weber <laochailan@web.de>.
|
|
|
|
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
|
2011-04-10 10:23:24 +02:00
|
|
|
*/
|
|
|
|
|
2021-08-12 23:09:01 +02:00
|
|
|
#pragma once
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
2011-04-10 10:23:24 +02:00
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
#include "enemy.h"
|
2011-05-06 17:09:43 +02:00
|
|
|
#include "projectile.h"
|
2011-06-25 12:41:40 +02:00
|
|
|
#include "player.h"
|
2020-11-28 11:11:10 +01:00
|
|
|
#include "cutscenes/cutscene.h"
|
2018-07-15 17:48:22 +02:00
|
|
|
#include "dialog.h"
|
2023-07-30 06:13:09 +02:00
|
|
|
#include "endings.h"
|
2011-06-25 12:41:40 +02:00
|
|
|
|
2017-10-08 13:30:51 +02:00
|
|
|
typedef enum {
|
2018-08-11 21:13:48 +02:00
|
|
|
// WARNING: Reordering this will break current replays, and possibly even progress files.
|
2011-06-25 12:41:40 +02:00
|
|
|
|
2018-08-11 21:13:48 +02:00
|
|
|
PLR_CHAR_REIMU = 0,
|
|
|
|
PLR_CHAR_MARISA = 1,
|
|
|
|
PLR_CHAR_YOUMU = 2,
|
2011-04-10 10:23:24 +02:00
|
|
|
|
2018-01-12 19:26:07 +01:00
|
|
|
NUM_CHARACTERS,
|
2017-10-08 13:30:51 +02:00
|
|
|
} CharacterID;
|
2011-04-29 10:26:37 +02:00
|
|
|
|
2017-10-08 13:30:51 +02:00
|
|
|
typedef enum {
|
2018-08-11 21:13:48 +02:00
|
|
|
// WARNING: Reordering this will break current replays, and possibly even progress files.
|
2011-06-29 17:01:03 +02:00
|
|
|
|
2018-05-02 08:08:32 +02:00
|
|
|
PLR_SHOT_A,
|
|
|
|
PLR_SHOT_B,
|
|
|
|
NUM_SHOT_MODES_PER_CHARACTER,
|
2011-06-25 12:41:40 +02:00
|
|
|
|
2018-05-02 08:08:32 +02:00
|
|
|
PLR_SHOT_MARISA_LASER = PLR_SHOT_A,
|
|
|
|
PLR_SHOT_MARISA_STAR = PLR_SHOT_B,
|
2011-11-04 18:54:53 +01:00
|
|
|
|
2018-05-02 08:08:32 +02:00
|
|
|
PLR_SHOT_YOUMU_MIRROR = PLR_SHOT_A,
|
|
|
|
PLR_SHOT_YOUMU_HAUNTING = PLR_SHOT_B,
|
2018-08-11 21:13:48 +02:00
|
|
|
|
|
|
|
PLR_SHOT_REIMU_SPIRIT = PLR_SHOT_A,
|
|
|
|
PLR_SHOT_REIMU_DREAM = PLR_SHOT_B,
|
2017-10-08 13:30:51 +02:00
|
|
|
} ShotModeID;
|
2012-07-16 17:47:06 +02:00
|
|
|
|
2023-07-30 06:36:44 +02:00
|
|
|
enum {
|
|
|
|
NUM_PLAYER_MODES = NUM_CHARACTERS * NUM_SHOT_MODES_PER_CHARACTER,
|
|
|
|
};
|
|
|
|
|
2018-05-02 08:08:32 +02:00
|
|
|
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;
|
|
|
|
|
2020-11-28 11:11:10 +01:00
|
|
|
typedef struct PlrCharEndingCutscene {
|
|
|
|
CutsceneID cutscene_id;
|
|
|
|
EndingID ending_id;
|
|
|
|
} PlrCharEndingCutscene;
|
2017-09-27 14:14:53 +02:00
|
|
|
|
2017-10-08 13:30:51 +02:00
|
|
|
typedef struct PlayerCharacter {
|
2019-07-08 02:47:50 +02:00
|
|
|
CharacterID id;
|
2018-01-12 19:26:07 +01:00
|
|
|
const char *lower_name;
|
|
|
|
const char *proper_name;
|
|
|
|
const char *full_name;
|
|
|
|
const char *title;
|
2019-04-22 14:29:44 +02:00
|
|
|
const char *menu_texture_name;
|
2018-01-12 19:26:07 +01:00
|
|
|
|
|
|
|
struct {
|
2020-11-28 11:11:10 +01:00
|
|
|
PlrCharEndingCutscene good;
|
|
|
|
PlrCharEndingCutscene bad;
|
2018-01-12 19:26:07 +01:00
|
|
|
} ending;
|
2017-10-08 13:30:51 +02:00
|
|
|
} PlayerCharacter;
|
|
|
|
|
2017-10-24 04:57:14 +02:00
|
|
|
typedef void (*PlayerModeInitProc)(Player *plr);
|
2017-11-25 16:51:43 +01:00
|
|
|
typedef void (*PlayerModeFreeProc)(Player *plr);
|
2023-03-22 23:41:32 +01:00
|
|
|
typedef void (*PlayerModePreloadProc)(ResourceGroup *rg);
|
2018-05-02 08:08:32 +02:00
|
|
|
typedef double (*PlayerModePropertyProc)(Player *plr, PlrProperty prop);
|
2017-10-08 13:30:51 +02:00
|
|
|
|
|
|
|
typedef struct PlayerMode {
|
2018-01-12 19:26:07 +01:00
|
|
|
const char *name;
|
2019-04-21 10:37:50 +02:00
|
|
|
const char *description;
|
2019-07-03 19:50:43 +02:00
|
|
|
const char *spellcard_name;
|
2018-01-12 19:26:07 +01:00
|
|
|
PlayerCharacter *character;
|
2020-01-23 01:23:35 +01:00
|
|
|
PlayerDialogTasks *dialog;
|
2018-01-12 19:26:07 +01:00
|
|
|
ShotModeID shot_mode;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
PlayerModeInitProc init;
|
|
|
|
PlayerModePreloadProc preload;
|
2018-05-02 08:08:32 +02:00
|
|
|
PlayerModePropertyProc property;
|
2018-01-12 19:26:07 +01:00
|
|
|
} procs;
|
2017-10-08 13:30:51 +02:00
|
|
|
} PlayerMode;
|
|
|
|
|
2020-04-27 21:58:25 +02:00
|
|
|
PlayerCharacter *plrchar_get(CharacterID id);
|
2023-03-22 23:41:32 +01:00
|
|
|
void plrchar_preload(PlayerCharacter *pc, ResourceGroup *rg);
|
2020-04-27 21:58:25 +02:00
|
|
|
void plrchar_render_bomb_portrait(PlayerCharacter *pc, Sprite *out_spr);
|
|
|
|
int plrchar_player_anim_name(PlayerCharacter *pc, size_t bufsize, char buf[bufsize]);
|
|
|
|
Animation *plrchar_player_anim(PlayerCharacter *pc);
|
2017-10-08 13:30:51 +02:00
|
|
|
|
2020-04-27 21:58:25 +02:00
|
|
|
PlayerMode *plrmode_find(CharacterID charid, ShotModeID shotid);
|
2019-04-16 07:30:45 +02:00
|
|
|
int plrmode_repr(char *out, size_t outsize, PlayerMode *mode, bool internal);
|
2020-04-27 21:58:25 +02:00
|
|
|
PlayerMode *plrmode_parse(const char *name);
|
2023-03-22 23:41:32 +01:00
|
|
|
void plrmode_preload(PlayerMode *mode, ResourceGroup *rg);
|
2018-05-02 08:08:32 +02:00
|
|
|
|
|
|
|
double player_property(Player *plr, PlrProperty prop);
|