persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
EnvironmentView Class Referenceabstract

#include <EnvironmentView.hpp>

Inheritance diagram for EnvironmentView:
Collaboration diagram for EnvironmentView:

Public Member Functions

void init () override
 One-time setup for a room.
ViewState update () override
 Per-frame update for this room's view.
void cleanup () override
 Tears down everything a room's view had set up.
bool usesBaseFadeIn () const override
 Whether BaseView should drive a dual-engine brightness fade-in.
Public Member Functions inherited from BaseView
virtual ~BaseView ()=default
void startFadeIn ()
void updateFadeIn ()

Protected Member Functions

virtual ae::q20_12_t getCameraYOffset () const
virtual const EnvironmentDbEntry * getEnvironmentDbEntry ()=0
virtual void setupText ()=0
virtual void setupMusic ()=0
virtual void setupMovement ()=0
virtual void setupUI ()
void setupPauseMenu ()
 Sets up the pause menu.
void setupMenuHUD (const std::string &location)
 Sets up the menu HUD.
virtual void setupDialogue ()
virtual void setupCamera ()
virtual void cleanupHook ()
virtual ViewState onTileCheck (TileType tile, uint32_t pressed)=0
virtual void startBattle ()
virtual void onBattleStart ()

Protected Attributes

touchPosition touch
int8_t bgSharedSub1 = -1
int8_t bgSharedSub2 = -1
int8_t bgSharedSub3 = -1
ViewPhase phase = ViewPhase::ENVIRONMENT
bool prevPauseState = false
bool prevDialogueState = false
bool prevEnvironmentState = false
bool prevBattleState = false
bool isBattleMenuActive = false
bool promptDrawn = false
Event::CameraPosition camPos
const ae::q20_12_t tileSize {0.062500}
Event::ConfigureCamera camConfig
MovementComponent * movement = nullptr
DialogueComponent * dialogue = nullptr
ae::Entity * environment = nullptr
GraphicsComponent * graphics = nullptr
TextComponent * text = nullptr
TextComponent * textSub = nullptr
TextComponent * textSubAlt = nullptr
TextComponent * textSubOptions = nullptr
AnimationController * animationCtrl = AnimationController::getInstance()
MusicComponent * musicCmpt = nullptr
SFXComponent * sfxCmpt = nullptr
DialogueScreen * dialogueScreen = nullptr
MenuHUDScreen * menuHUDScreen = nullptr
PauseMenuScreen * pauseMenuScreen = nullptr
BattleMenu * battleMenuCmpt = nullptr
PauseMenu * pauseMenuCmpt = nullptr
std::array< int, 2 > bgMain
std::array< int, 3 > bgSub
Environment env
const EnvironmentDbEntry * dbEntry = nullptr
uint16_t * textVideoBuffer = nullptr
uint16_t * textVideoBufferSub = nullptr
std::string fontName = "cosmetica"
uint8_t fontSize = 12
std::string optionsFontName = "noto-sans-jp-extra-bold"
uint8_t optionsFontSize = 19
uint8_t lineSpacing = 0
Dialogue * dialogueFirstLine = nullptr

Private Member Functions

const unsigned int * loadBitmap (const std::string &path, GraphicAsset &asset)
 Loads a single .grit asset and returns its raw tile pointer.
void setupEnvironment ()
 Loads and uploads a room's environment geometry and textures, driven entirely by dbEntry.
void setupModel ()

Private Attributes

RenderManager & render = RenderManager::getInstance()

Detailed Description

Definition at line 42 of file EnvironmentView.hpp.

Member Function Documentation

◆ cleanup()

void EnvironmentView::cleanup ( )
overridevirtual

Tears down everything a room's view had set up.

Reimplemented from BaseView.

Definition at line 504 of file EnvironmentView.cpp.

Here is the call graph for this function:

◆ cleanupHook()

virtual void EnvironmentView::cleanupHook ( )
inlineprotectedvirtual

Definition at line 120 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ getCameraYOffset()

virtual ae::q20_12_t EnvironmentView::getCameraYOffset ( ) const
inlineprotectedvirtual

Reimplemented in PaulowniaMallView.

Definition at line 82 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ getEnvironmentDbEntry()

virtual const EnvironmentDbEntry * EnvironmentView::getEnvironmentDbEntry ( )
protectedpure virtual

Implemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Here is the caller graph for this function:

◆ init()

void EnvironmentView::init ( )
overridevirtual

One-time setup for a room.

Note
Resolves a room's EnvironmentDbEntry once into dbEntry. Everything below reads from that member instead of re-deriving it or relying on a per-room generated type. If no entry can be resolved, init() logs an error and returns immediately, since nothing below this point can run without a valid entry (setupEnvironment() immediately dereferences dbEntry->name).

Implements BaseView.

Definition at line 106 of file EnvironmentView.cpp.

Here is the call graph for this function:

◆ loadBitmap()

const unsigned int * EnvironmentView::loadBitmap ( const std::string & path,
GraphicAsset & asset )
private

Loads a single .grit asset and returns its raw tile pointer.

Stashes the owning GraphicAsset in asset so the caller can unload it once the texture has been uploaded to VRAM.

Parameters
pathFull path (base path + grit base name) of the asset to load.
assetOutput parameter that receives the loaded GraphicAsset, which the caller is responsible for unloading later.
Returns
Raw pointer to the asset's tile data, reinterpreted as unsigned int, suitable for passing to the texture upload code.

Definition at line 40 of file EnvironmentView.cpp.

Here is the caller graph for this function:

◆ onBattleStart()

virtual void EnvironmentView::onBattleStart ( )
inlineprotectedvirtual

Definition at line 132 of file EnvironmentView.hpp.

◆ onTileCheck()

virtual ViewState EnvironmentView::onTileCheck ( TileType tile,
uint32_t pressed )
protectedpure virtual
Here is the caller graph for this function:

◆ setupCamera()

virtual void EnvironmentView::setupCamera ( )
inlineprotectedvirtual

Reimplemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Definition at line 116 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ setupDialogue()

virtual void EnvironmentView::setupDialogue ( )
inlineprotectedvirtual

Reimplemented in IwatodaiDormView.

Definition at line 111 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ setupEnvironment()

void EnvironmentView::setupEnvironment ( )
private

Loads and uploads a room's environment geometry and textures, driven entirely by dbEntry.

Note
No per-room texture-slot code and no per-room generated class needed.

Loads each texture slot's texture assets to build display lists and upload textures to VRAM, then unloads the texture assets. Logs a message if environment loading fails, since a failed load otherwise leaves environments silently rendering nothing.

Definition at line 78 of file EnvironmentView.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupMenuHUD()

void EnvironmentView::setupMenuHUD ( const std::string & location)
protected

Sets up the menu HUD.

Parameters
locationThe location name shown on the HUD

Definition at line 570 of file EnvironmentView.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupModel()

void EnvironmentView::setupModel ( )
private

Loads a model's bitmap textures into memory & passes them to AnimationController

Definition at line 46 of file EnvironmentView.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupMovement()

virtual void EnvironmentView::setupMovement ( )
protectedpure virtual

Implemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Here is the caller graph for this function:

◆ setupMusic()

virtual void EnvironmentView::setupMusic ( )
protectedpure virtual

Implemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Here is the caller graph for this function:

◆ setupPauseMenu()

void EnvironmentView::setupPauseMenu ( )
protected

Sets up the pause menu.

Definition at line 552 of file EnvironmentView.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupText()

virtual void EnvironmentView::setupText ( )
protectedpure virtual

Implemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Here is the caller graph for this function:

◆ setupUI()

virtual void EnvironmentView::setupUI ( )
inlineprotectedvirtual

Reimplemented in IwatodaiDormView, IwatodaiStreetsView, PaulowniaMallView, and StationView.

Definition at line 95 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ startBattle()

virtual void EnvironmentView::startBattle ( )
inlineprotectedvirtual

Reimplemented in IwatodaiStreetsView.

Definition at line 128 of file EnvironmentView.hpp.

Here is the caller graph for this function:

◆ update()

ViewState EnvironmentView::update ( )
overridevirtual

Per-frame update for this room's view.

Note
Advances the current ViewPhase, updates Controllers, and reports whether a phase transition to a different ViewState should occur.
Returns
ViewState::KEEP_CURRENT to remain on this view for another frame, or another ViewState value to signal that the caller should transition away from this view entirely.

Implements BaseView.

Definition at line 254 of file EnvironmentView.cpp.

Here is the call graph for this function:

◆ usesBaseFadeIn()

bool EnvironmentView::usesBaseFadeIn ( ) const
inlineoverridevirtual

Whether BaseView should drive a dual-engine brightness fade-in.

Reimplemented from BaseView.

Definition at line 75 of file EnvironmentView.hpp.

Member Data Documentation

◆ animationCtrl

AnimationController* EnvironmentView::animationCtrl = AnimationController::getInstance()
protected

Definition at line 175 of file EnvironmentView.hpp.

◆ battleMenuCmpt

BattleMenu* EnvironmentView::battleMenuCmpt = nullptr
protected

Definition at line 185 of file EnvironmentView.hpp.

◆ bgMain

std::array<int, 2> EnvironmentView::bgMain
protected

Definition at line 188 of file EnvironmentView.hpp.

◆ bgSharedSub1

int8_t EnvironmentView::bgSharedSub1 = -1
protected

Definition at line 140 of file EnvironmentView.hpp.

◆ bgSharedSub2

int8_t EnvironmentView::bgSharedSub2 = -1
protected

Definition at line 141 of file EnvironmentView.hpp.

◆ bgSharedSub3

int8_t EnvironmentView::bgSharedSub3 = -1
protected

Definition at line 142 of file EnvironmentView.hpp.

◆ bgSub

std::array<int, 3> EnvironmentView::bgSub
protected

Definition at line 189 of file EnvironmentView.hpp.

◆ camConfig

Event::ConfigureCamera EnvironmentView::camConfig
protected

Definition at line 157 of file EnvironmentView.hpp.

◆ camPos

Event::CameraPosition EnvironmentView::camPos
protected

Definition at line 153 of file EnvironmentView.hpp.

◆ dbEntry

const EnvironmentDbEntry* EnvironmentView::dbEntry = nullptr
protected

Definition at line 194 of file EnvironmentView.hpp.

◆ dialogue

DialogueComponent* EnvironmentView::dialogue = nullptr
protected

Definition at line 164 of file EnvironmentView.hpp.

◆ dialogueFirstLine

Dialogue* EnvironmentView::dialogueFirstLine = nullptr
protected

Definition at line 209 of file EnvironmentView.hpp.

◆ dialogueScreen

DialogueScreen* EnvironmentView::dialogueScreen = nullptr
protected

Definition at line 181 of file EnvironmentView.hpp.

◆ env

Environment EnvironmentView::env
protected

Definition at line 193 of file EnvironmentView.hpp.

◆ environment

ae::Entity* EnvironmentView::environment = nullptr
protected

Definition at line 168 of file EnvironmentView.hpp.

◆ fontName

std::string EnvironmentView::fontName = "cosmetica"
protected

Definition at line 200 of file EnvironmentView.hpp.

◆ fontSize

uint8_t EnvironmentView::fontSize = 12
protected

Definition at line 201 of file EnvironmentView.hpp.

◆ graphics

GraphicsComponent* EnvironmentView::graphics = nullptr
protected

Definition at line 169 of file EnvironmentView.hpp.

◆ isBattleMenuActive

bool EnvironmentView::isBattleMenuActive = false
protected

Definition at line 150 of file EnvironmentView.hpp.

◆ lineSpacing

uint8_t EnvironmentView::lineSpacing = 0
protected

Definition at line 205 of file EnvironmentView.hpp.

◆ menuHUDScreen

MenuHUDScreen* EnvironmentView::menuHUDScreen = nullptr
protected

Definition at line 182 of file EnvironmentView.hpp.

◆ movement

MovementComponent* EnvironmentView::movement = nullptr
protected

Definition at line 161 of file EnvironmentView.hpp.

◆ musicCmpt

MusicComponent* EnvironmentView::musicCmpt = nullptr
protected

Definition at line 176 of file EnvironmentView.hpp.

◆ optionsFontName

std::string EnvironmentView::optionsFontName = "noto-sans-jp-extra-bold"
protected

Definition at line 202 of file EnvironmentView.hpp.

◆ optionsFontSize

uint8_t EnvironmentView::optionsFontSize = 19
protected

Definition at line 203 of file EnvironmentView.hpp.

◆ pauseMenuCmpt

PauseMenu* EnvironmentView::pauseMenuCmpt = nullptr
protected

Definition at line 186 of file EnvironmentView.hpp.

◆ pauseMenuScreen

PauseMenuScreen* EnvironmentView::pauseMenuScreen = nullptr
protected

Definition at line 183 of file EnvironmentView.hpp.

◆ phase

ViewPhase EnvironmentView::phase = ViewPhase::ENVIRONMENT
protected

Definition at line 144 of file EnvironmentView.hpp.

◆ prevBattleState

bool EnvironmentView::prevBattleState = false
protected

Definition at line 149 of file EnvironmentView.hpp.

◆ prevDialogueState

bool EnvironmentView::prevDialogueState = false
protected

Definition at line 147 of file EnvironmentView.hpp.

◆ prevEnvironmentState

bool EnvironmentView::prevEnvironmentState = false
protected

Definition at line 148 of file EnvironmentView.hpp.

◆ prevPauseState

bool EnvironmentView::prevPauseState = false
protected

Definition at line 146 of file EnvironmentView.hpp.

◆ promptDrawn

bool EnvironmentView::promptDrawn = false
protected

Definition at line 151 of file EnvironmentView.hpp.

◆ render

RenderManager& EnvironmentView::render = RenderManager::getInstance()
private

Definition at line 212 of file EnvironmentView.hpp.

◆ sfxCmpt

SFXComponent* EnvironmentView::sfxCmpt = nullptr
protected

Definition at line 177 of file EnvironmentView.hpp.

◆ text

TextComponent* EnvironmentView::text = nullptr
protected

Definition at line 170 of file EnvironmentView.hpp.

◆ textSub

TextComponent* EnvironmentView::textSub = nullptr
protected

Definition at line 171 of file EnvironmentView.hpp.

◆ textSubAlt

TextComponent* EnvironmentView::textSubAlt = nullptr
protected

Definition at line 172 of file EnvironmentView.hpp.

◆ textSubOptions

TextComponent* EnvironmentView::textSubOptions = nullptr
protected

Definition at line 173 of file EnvironmentView.hpp.

◆ textVideoBuffer

uint16_t* EnvironmentView::textVideoBuffer = nullptr
protected

Definition at line 198 of file EnvironmentView.hpp.

◆ textVideoBufferSub

uint16_t* EnvironmentView::textVideoBufferSub = nullptr
protected

Definition at line 199 of file EnvironmentView.hpp.

◆ tileSize

const ae::q20_12_t EnvironmentView::tileSize {0.062500}
protected

Definition at line 154 of file EnvironmentView.hpp.

◆ touch

touchPosition EnvironmentView::touch
protected

Definition at line 138 of file EnvironmentView.hpp.


The documentation for this class was generated from the following files: