persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
EnvironmentView.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <aegis/ndsTypes.hpp>
4#include <aegis/types.hpp>
5
6#include "views/BaseView.hpp"
7
8// environments/data
11// components
22// controllers
24// managers
26//systems
28
29#include <cstdint>
30#include <etl/array.h>
31#include <etl/span.h>
32#include <string>
33
41
43{
44 public:
55 void init() override;
56
68 ViewState update() override;
69
73 void cleanup() override;
74
75 bool usesBaseFadeIn() const override
76 {
77 return true;
78 }
79
80 protected:
81 // Room-specific hooks (implemented/overridden by derived rooms)
82 virtual ae::q20_12_t getCameraYOffset() const
83 {
84 return ae::q20_12_t{0.1};
85 } // default
86
88
89 virtual void setupText() = 0;
90
91 virtual void setupMusic() = 0;
92
93 virtual void setupMovement() = 0;
94
95 virtual void setupUI()
96 {
97 }
98
102 void setupPauseMenu();
103
109 void setupMenuHUD(const std::string& location);
110
111 virtual void setupDialogue()
112 {
113 }
114
115 // TODO: enforce?
116 virtual void setupCamera()
117 {
118 }
119
120 virtual void cleanupHook()
121 {
122 }
123
124 virtual ViewState onTileCheck(TileType tile, uint32_t pressed) = 0;
125
126 // -------------------------------------------------
127 // Battle hooks
128 virtual void startBattle()
129 {
130 }
131
132 virtual void onBattleStart()
133 {
134 }
135
136 // -------------------------------------------------
137 // Shared state
138 touchPosition touch;
139
140 int8_t bgSharedSub1 = -1;
141 int8_t bgSharedSub2 = -1;
142 int8_t bgSharedSub3 = -1;
143
145
146 bool prevPauseState = false;
147 bool prevDialogueState = false;
149 bool prevBattleState = false;
150 bool isBattleMenuActive = false;
151 bool promptDrawn = false;
152
154 const ae::q20_12_t tileSize{0.062500};
155
156 // Override fields in setCameraConfig() — same struct for all modes
158
159 // -------------------------------------------------
160 // Player
162 // TODO: move dialogue, text component to actual actors!
163 // In this case, it would be the Akihiko billboard
165
166 // -------------------------------------------------
167 // View / entity
168 ae::Entity* environment = nullptr;
170 TextComponent* text = nullptr;
174
178
179 // -------------------------------------------------
180 // UI
184
187
188 std::array<int, 2> bgMain;
189 std::array<int, 3> bgSub;
190
191 // -------------------------------------------------
192 // Environment
194 const EnvironmentDbEntry* dbEntry = nullptr;
195
196 // -------------------------------------------------
197 // Text
198 uint16_t* textVideoBuffer = nullptr;
199 uint16_t* textVideoBufferSub = nullptr;
200 std::string fontName = "cosmetica";
201 uint8_t fontSize = 12;
202 std::string optionsFontName = "noto-sans-jp-extra-bold";
203 uint8_t optionsFontSize = 19;
204 // set in init()
205 uint8_t lineSpacing = 0;
206
207 // -------------------------------------------------
208 // Dialogue
210
211 private:
212 RenderManager& render = RenderManager::getInstance();
213
226 const unsigned int* loadBitmap(const std::string& path, GraphicAsset& asset);
227
239 void setupEnvironment();
240
244 void setupModel();
245};
Manages the camera for a 3D environment view.
Orchestrates dialogue display & branching logic.
Orchestrates graphic loading and management.
Handles the rendering & logic for the menu HUD UI.
Orchestrates the movement & view logic for a 3D environment view.
TileType
Orchestrates music.
Pause menu screen.
Manager for hardware specific rendering functionse.
Orchestrates sfx.
ViewState
Definition StateTypes.hpp:4
Loads, animates, and renders a model in the DS geometry engine.
static AnimationController * getInstance()
virtual const EnvironmentDbEntry * getEnvironmentDbEntry()=0
virtual ViewState onTileCheck(TileType tile, uint32_t pressed)=0
std::array< int, 2 > bgMain
TextComponent * textSubAlt
TextComponent * textSubOptions
void setupEnvironment()
Loads and uploads a room's environment geometry and textures, driven entirely by dbEntry.
virtual void cleanupHook()
virtual void setupText()=0
MenuHUDScreen * menuHUDScreen
MusicComponent * musicCmpt
const EnvironmentDbEntry * dbEntry
AnimationController * animationCtrl
MovementComponent * movement
Event::CameraPosition camPos
Event::ConfigureCamera camConfig
Dialogue * dialogueFirstLine
uint16_t * textVideoBuffer
std::array< int, 3 > bgSub
virtual void setupMusic()=0
ViewState update() override
Per-frame update for this room's view.
void init() override
One-time setup for a room.
SFXComponent * sfxCmpt
const ae::q20_12_t tileSize
GraphicsComponent * graphics
virtual void setupDialogue()
bool usesBaseFadeIn() const override
Whether BaseView should drive a dual-engine brightness fade-in.
touchPosition touch
const unsigned int * loadBitmap(const std::string &path, GraphicAsset &asset)
Loads a single .grit asset and returns its raw tile pointer.
RenderManager & render
virtual void setupUI()
void cleanup() override
Tears down everything a room's view had set up.
void setupPauseMenu()
Sets up the pause menu.
virtual ae::q20_12_t getCameraYOffset() const
uint16_t * textVideoBufferSub
DialogueScreen * dialogueScreen
PauseMenu * pauseMenuCmpt
TextComponent * text
virtual void setupMovement()=0
virtual void onBattleStart()
virtual void setupCamera()
void setupMenuHUD(const std::string &location)
Sets up the menu HUD.
BattleMenu * battleMenuCmpt
virtual void startBattle()
TextComponent * textSub
ae::Entity * environment
PauseMenuScreen * pauseMenuScreen
DialogueComponent * dialogue
std::string optionsFontName
Holds dialogue content and branching data.
Output of CameraSystem::update(ae::q20_12_t), consumed by gluLookAt().
All parameters needed to configure a CameraSystem in one call.
Holds loaded graphics data.