Skip to content

Commit a4c7f58

Browse files
authored
Merge pull request #1 from weirdbeardgame/main
Adds some Fatal Frame 1 Documentation for Game and InGame
2 parents 6a421ba + 3a4019c commit a4c7f58

6 files changed

Lines changed: 174 additions & 15 deletions

File tree

docs/Fatal_Frame_1/Game/Game.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Summary
2+
Game is the inializer of Fatal Frame that has different types each with different functions.
3+
Game is used to select the current "Game Mode" that lead each to their own state machines and modes.
4+
5+
[Main Function of Game](https://decomp.me/scratch/I3p0e)
6+
7+
## Types of Game
8+
<details>
9+
<summary>List Of Game</summary>
10+
```c
11+
enum GAME_MODE {
12+
GAME_MODE_INIT = 0,
13+
GAME_MODE_MCCHECK = 1,
14+
GAME_MODE_OUTGAME = 2,
15+
GAME_MODE_INGAME = 3
16+
};
17+
```
18+
</details>
19+
20+
## Modes
21+
22+
### INIT
23+
Initalizer on first startup, Calls [GameInit](https://decomp.me/scratch/1bB4V) -> [GameInitLoad](https://decomp.me/scratch/Q5V7S) as well as [gra3dInit](https://decomp.me/scratch/NOvdS) to initalize some renderer params
24+
25+
<details>
26+
<summary> List of Game Init</summary>
27+
```c
28+
enum {
29+
GAME_INIT_LOAD_START = 0,
30+
GAME_INIT_LOAD_MSG_DAT = 1,
31+
GAME_INIT_WAIT_MSG_DAT = 2,
32+
GAME_INIT_LOAD_FONT_TEX = 3,
33+
GAME_INIT_WAIT_FONT_TEX = 4,
34+
GAME_INIT_LOAD_SE_STAT = 5,
35+
GAME_INIT_WAIT_SE_STAT = 6,
36+
GAME_INIT_LOAD_END = 7
37+
};
38+
```
39+
</details>
40+
41+
Initalization is done in a simplistic Switch case design, step by step.
42+
Load required files, sets next step, processes files and continue.
43+
44+
### MCCHECK
45+
[mcStartCheckMain](https://decomp.me/scratch/jA7bV)
46+
Checks for valid inserted card and checks for space.
47+
Works in steps to do so.
48+
49+
50+
### OUTGAME
51+
[OutGameCtrl](https://decomp.me/scratch/fSeg3)
52+
Outgame encompases several key functions including Title Screen, save menus and other non InGame functions including starting Battle Mode.
53+
Outgame's main purpose is anything before or after gameplay.
54+
Displays the main logo's before actual gameplay starts
55+
Sets and loads all title screen functions
56+
Handles Battle Mode menus and mode changing
57+
Handles all other menus, Options, Debug's, etc.
58+
59+
### INGAME
60+
[InGameCtrl](https://decomp.me/scratch/wcowl)
61+
[InGameMain](https://decomp.me/scratch/1ERKo) - Note original match by Karas. This is adjusted, adding a missing jtbl and enums
62+
63+
The Main Functionality of this engine where the main game loop and all other main game stuff occurs.
64+
Ingame has several modes and functions that occur in those modes.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Summary
2+
Fatal Frame 1 uses an Atypical enum switch case design for modes of ingame functionality.
3+
As far as we are currently aware the modes are the same across versions. (`PAL, NTSC`)
4+
Ingame uses several structs to define and interact with the various logic throught the engine though most prolific is `ingame_wrk`
5+
6+
# Modes
7+
8+
### Ingame Work Modes
9+
<details>
10+
<summary>List Of INGAME MODE</summary>
11+
```c
12+
enum {
13+
INGAME_MODE_FIRST_LOAD = 0,
14+
INGAME_MODE_INIT = 1,
15+
INGAME_MODE_WAIT = 2,
16+
INGAME_MODE_NEW_GAME = 3,
17+
INGAME_MODE_LOAD_START = 4,
18+
INGAME_MODE_MSN_TITLE = 5,
19+
INGAME_MODE_NOMAL = 6,
20+
INGAME_MODE_EVENT = 7,
21+
INGAME_MODE_SPECIAL_EVENT = 8,
22+
INGAME_MODE_AREA_MOVE = 9,
23+
INGAME_MODE_MENU = 10,
24+
INGAME_MODE_PAUSE = 11,
25+
INGAME_MODE_SPD_MAP = 12,
26+
INGAME_MODE_SPD_OPT = 13,
27+
INGAME_MODE_GET_ITEM = 14,
28+
INGAME_MODE_WANDER_SOUL = 15,
29+
INGAME_MODE_SAVE_POINT = 16,
30+
INGAME_MODE_PHOTO_AFTER = 17,
31+
INGAME_MODE_GHOST_DEAD = 18,
32+
INGAME_MODE_SGST_DISP = 19,
33+
INGAME_MODE_GAME_OVER = 20,
34+
INGAME_MODE_GAME_OVER_ALBUM = 21,
35+
INGAME_MODE_INTER_MSN = 22,
36+
INGAME_MODE_ENDING = 23,
37+
INGAME_MODE_WAIT_MSN0 = 24
38+
};
39+
```
40+
</details>
41+
42+
## Process of Initalization
43+
The process of Initalization starts wtih mode `INGAME_MODE_INIT`
44+
Calls [InGameInit](https://decomp.me/scratch/8dB6u)
45+
Where all ingame engine initalization's occur prior to the title screen.
46+
Most notably loads Player data, preloads Model data, initalizes the event system
47+
And most other systems as well.
48+
49+
Then we continue to `INGAME_MODE_MSN_TITLE`
50+
[InGameInit2](https://decomp.me/scratch/IJ5HJ) is called
51+
Stage data, Camera data, all rendering systes are loaded here.
52+
Memory Card data will have already been read prior to this being called and the player set into the scene.
53+
54+
## Missions
55+
56+
### Zero Hour
57+
Mafuyu, Miku's older brother is playable in this mode, and this mode only.
58+
Features it's own Battle System found mainly in `ap_zgost.c`, `ZeroHourAppearMain` being the main spawn logic for it.
59+
Appears to feature it's own physics logic that does not apply to Miku.
60+
Mission uses black and white filter effect over screen that is used throught many scenes of the game.
61+
Force activating the debug menu allows this filter to be turned on and off at a whim.
62+
63+
### Miku Missions, Nights 1, 2, 3, 4
64+
The main logic of the game. All Standard modes, battle functions, events, room transitions, etc apply here.
65+
66+
- `INGAME_MODE_NORMAL`:
67+
The main game loop. Player control and gameplay stuff occurs in here.
68+
This will also check for the BattleModeGame if the player has previously completed this game and selected it.
69+
70+
- `INGAME_MODE_EVENT`:
71+
Calls [EventMain](https://decomp.me/scratch/AvnAm)
72+
Event system is run here. Will be talked about in more detail in other documentation.
73+
Needless to say, this wrenches control from main game loop and subsuqently player.
74+
75+
- `INGAME_MODE_SPECIAL_EVENT`:
76+
Special events consist of several different types and functions.
77+
Though most notable are the ingame puzzles
78+
79+
- Star Puzzle (The Sliding Stone game)
80+
- Dial Key Door (The Number lock combination doors)
81+
- Doll Puzzle (Kaaggommee, Kaaggommee) - Used only a single time in Night 2
82+
83+
At least some of these have their own list of files on disc for hard coded puzzles.
84+
Each of these each have their own seperate game loop that takes inputs.
File renamed without changes.
File renamed without changes.
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Summary
22

3-
The gaame uses a `GPhaseSystem` to split the logic into game sections. It is located under the [gphase.cpp](https://github.com/wagrenier/Mikompilation/blob/main/zero_rom/zero2np/src/main/gphase.cpp) file. Please take not that all the following information is pulled from the EU version. The EU version has a few more states than the US/JP versions:
3+
The game uses a `GPhaseSystem` to split the logic into game sections. It is located under the [gphase.cpp](https://github.com/Mikompilation/Minakami/blob/main/src/main/gphase.c) file. Please note that all of the following information is pulled from the PAL version of the game. The PAL version has a few more states than the NTSC versions:
44

5-
1. A language selection upon first boot
6-
2. A screen refresh rate selector
7-
3. A boot video of Ubisoft's logo
5+
### PAL Specific States:
6+
1. A language selection upon first boot (`GID_LANGSEL_MAIN`)
7+
2. A screen refresh rate selector (`GID_TITLE_FRAMERATE_SEL`)
8+
3. A boot video of Ubisoft's logo (`GID_TITLE_MOVE_MOVIE`)
89

910
## Basic Components
1011
### Game Phases
1112

12-
In Fatal Frame 2, a `Game Phase (GPhase)` represents the current action (phase) the game is currently performing. Each phase serves to handle a particular part of the game such as loading the game, menu traversal, selecting a lanaguage, and so on... A `GPhase` is represented by a `GPHASE_ID_ENUM`, an enum that contains all possible game phases (see list below). Those phases also have handler functions that will contain all code to perform the action!
13+
In Fatal Frame 2, a `Game Phase (GPhase)` represents the current action `(phase)` the game is currently performing. Each phase serves to handle a particular part of the game such as loading the game, menu traversal, selecting a lanaguage, and so on... A `GPhase` is represented by a `GPHASE_ID_ENUM`, an enum that contains all possible game phases (see list below). Those phases also have handler functions that will contain all code to perform the action!
1314

1415
<details>
1516
<summary>List Of GPhases</summary>
@@ -252,7 +253,7 @@ Take note that the `SUPER GPHASE (GID_SUPER)` is at **position 0/ is the first e
252253
253254
## Structured GPhase Data
254255
255-
### Structure Definitions
256+
### Structure Definitions:
256257
#### GPHASE_DAT
257258
258259
The `GPHASE_DAT` structure contains all information related to a game phase. The layer indicates to which layer a game phase belongs to. `superID` indicates the parent of that phase. `son_ID` indicates the child of a game phase and `son_num` indicates how many children a game phase has.

mkdocs.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
site_name: Mikompilation
22
site_url: https://www.mikompilation.com
3-
site_description: Research project to reimplement Fatal Frame 2
3+
site_description: Research project to reimplement Fatal Frame
44
site_author: wagrenier
5+
site_coauthor: weirdbeardgame
56

67
repo_url: https://github.com/wagrenier/Mikompilation
78
edit_uri: blob/main/docs
89

910
nav:
1011
- Home: index.md
1112
- Build: Build.md
12-
- Engine:
13-
- Engine/Engine.md
14-
- 3D:
15-
- SGD: Engine/3D/SGD.md
16-
- Game:
17-
- GPhaseSytem: Game/GPhaseSystem.md
1813

19-
theme:
14+
- Fatal Frame 1:
15+
- Engine:
16+
- Fatal_Frame_1/Engine
17+
- Game:
18+
- Game: Fatal_Frame_1/Game/Game.md
19+
- Ingame: Fatal_Frame_1/Game/Ingame/Ingame.md
20+
21+
- Fatal Frame 2:
22+
- Engine:
23+
- Fatal_Frame_2/Engine/Engine.md
24+
- 3D:
25+
- SGD: Fatal_Frame_2/Engine/3D/SGD.md
26+
- Game:
27+
- GPhaseSytem: Fatal_Frame_2/Game/GPhaseSystem.md
28+
29+
theme:
2030
name: material
2131
logo: img/angry_noise_sae.png
2232
favicon: img/favicon.ico
@@ -35,4 +45,4 @@ markdown_extensions:
3545
- pymdownx.superfences
3646

3747
plugins:
38-
- search
48+
- search

0 commit comments

Comments
 (0)