forked from julianxhokaxhiu/FFNx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidescreen.h
141 lines (115 loc) · 3.82 KB
/
widescreen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/****************************************************************************/
// Copyright (C) 2009 Aali132 //
// Copyright (C) 2018 quantumpencil //
// Copyright (C) 2018 Maxime Bacoux //
// Copyright (C) 2020 myst6re //
// Copyright (C) 2020 Chris Rizzitello //
// Copyright (C) 2020 John Pritchard //
// Copyright (C) 2024 Julian Xhokaxhiu //
// Copyright (C) 2023 Tang-Tang Zhou //
// Copyright (C) 2023 Cosmos //
// //
// This file is part of FFNx //
// //
// FFNx is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License //
// //
// FFNx is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
/****************************************************************************/
#pragma once
#include "common.h"
#include "globals.h"
#include <vector>
int wide_viewport_x = -107;
int wide_viewport_y = 0;
int wide_viewport_width = 854;
int wide_viewport_height = 480;
int wide_game_x = 0;
int wide_game_y = 0;
int wide_game_width = 854;
int wide_game_height = 480;
void ff7_widescreen_hook_init();
enum WIDESCREEN_MODE
{
WM_DISABLED,
WM_EXTEND_ONLY,
WM_ZOOM,
WM_EXTEND_WIDE,
WM_FILL
};
struct Keyframe
{
int frame = 0;
int v_offset = 0;
};
struct KeyPair
{
Keyframe first;
Keyframe second;
};
class Widescreen
{
public:
void init();
void initParamsFromConfig();
void initMovieParamsFromConfig(char *name);
const field_camera_range& getCameraRange();
int getHorizontalOffset();
int getVerticalOffset();
bool isResetVerticalPos();
bool isScriptedClipEnabled();
WIDESCREEN_MODE getMode();
KeyPair getMovieKeyPair(int frame);
WIDESCREEN_MODE getMovieMode();
void zoomBackground();
private:
void loadConfig();
void loadMovieConfig();
private:
// Config
toml::parse_result config;
toml::parse_result movie_config;
field_camera_range camera_range;
int h_offset = 0;
int v_offset = 0;
bool is_reset_vertical_pos = false;
bool is_scripted_clip_enabled = true;
WIDESCREEN_MODE widescreen_mode = WM_DISABLED;
std::vector<Keyframe> movie_v_offset;
WIDESCREEN_MODE widescreen_movie_mode = WM_DISABLED;
};
inline const field_camera_range& Widescreen::getCameraRange()
{
return camera_range;
}
inline int Widescreen::getHorizontalOffset()
{
return h_offset;
}
inline int Widescreen::getVerticalOffset()
{
return v_offset;
}
inline bool Widescreen::isResetVerticalPos()
{
return is_reset_vertical_pos;
}
inline bool Widescreen::isScriptedClipEnabled()
{
return is_scripted_clip_enabled;
}
inline WIDESCREEN_MODE Widescreen::getMode()
{
struct game_mode* mode = getmode_cached();
if (mode->driver_mode != MODE_FIELD) return WM_DISABLED;
return widescreen_mode;
}
inline WIDESCREEN_MODE Widescreen::getMovieMode()
{
return widescreen_movie_mode;
}
extern Widescreen widescreen;