mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: move CrosshairSway and FovY to the [Game] ini section
fov doesn't really belong in the video functions either
This commit is contained in:
1 parent
4947350230
commit
af1422a1de
9 files changed
+34
-35
No files matched your search
@@ -19,7 +19,6 @@ s32 videoGetNativeHeight(void);
|
||||
s32 videoGetWidth(void);
|
||||
s32 videoGetHeight(void);
|
||||
f32 videoGetAspect(void);
|
||||
f32 videoGetPlayerFovY(void);
|
||||
|
||||
s32 videoCreateFramebuffer(u32 w, u32 h);
|
||||
void videoSetFramebuffer(s32 target);
|
||||
|
||||
@@ -130,8 +130,6 @@ static const char *vkJoyNames[] = {
|
||||
|
||||
static char vkNames[VK_TOTAL_COUNT][64];
|
||||
|
||||
f32 crosshairSway = 1.f;
|
||||
|
||||
void inputSetDefaultKeyBinds(void)
|
||||
{
|
||||
// TODO: make VK constants for all these
|
||||
@@ -461,8 +459,6 @@ s32 inputInit(void)
|
||||
|
||||
inputLoadBinds();
|
||||
|
||||
crosshairSway = configGetFloat("Input.CrosshairSway", 1.f);
|
||||
|
||||
return connectedMask;
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "lib/main.h"
|
||||
#include "bss.h"
|
||||
#include "data.h"
|
||||
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
@@ -59,6 +60,13 @@ static void cleanup(void)
|
||||
// TODO: actually shut down all subsystems
|
||||
}
|
||||
|
||||
static void gameLoadConfig(void)
|
||||
{
|
||||
osMemSize = configGetInt("Game.MemorySize", 16) * 1024 * 1024;
|
||||
g_PlayerCrosshairSway = configGetFloat("Game.CrosshairSway", g_PlayerCrosshairSway);
|
||||
g_PlayerDefaultFovY = configGetFloat("Game.FovY", g_PlayerDefaultFovY);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
sysInitTicks();
|
||||
@@ -69,12 +77,12 @@ int main(int argc, const char **argv)
|
||||
audioInit();
|
||||
romdataInit();
|
||||
|
||||
gameLoadConfig();
|
||||
|
||||
atexit(cleanup);
|
||||
|
||||
bootCreateSched();
|
||||
|
||||
osMemSize = configGetInt("Game.MemorySize", 16) * 1024 * 1024;
|
||||
|
||||
g_OsMemSize = osGetMemSize();
|
||||
|
||||
g_MempHeapSize = g_OsMemSize;
|
||||
|
||||
@@ -21,8 +21,6 @@ static u32 frames = 0;
|
||||
static u32 framesPerSec = 0;
|
||||
static f64 startTime, endTime, fpsTime;
|
||||
|
||||
static f32 playerFovY = 60.f;
|
||||
|
||||
s32 videoInit(void)
|
||||
{
|
||||
wmAPI = &gfx_sdl;
|
||||
@@ -30,8 +28,6 @@ s32 videoInit(void)
|
||||
gfx_current_native_viewport.width = 320;
|
||||
gfx_current_native_viewport.height = 240;
|
||||
|
||||
playerFovY = configGetFloat("Video.FovY", 60.f);
|
||||
|
||||
const s32 w = configGetInt("Video.DefaultWidth", 640);
|
||||
const s32 h = configGetInt("Video.DefaultHeight", 480);
|
||||
const bool fs = configGetInt("Video.DefaultFullscreen", false);
|
||||
@@ -138,11 +134,6 @@ f32 videoGetAspect(void)
|
||||
return gfx_current_dimensions.aspect_ratio;
|
||||
}
|
||||
|
||||
f32 videoGetPlayerFovY(void)
|
||||
{
|
||||
return playerFovY;
|
||||
}
|
||||
|
||||
s32 videoCreateFramebuffer(u32 w, u32 h)
|
||||
{
|
||||
return gfx_create_framebuffer(w, h);
|
||||
|
||||
+2
-2
@@ -7496,12 +7496,12 @@ void bgunCreateFx(struct hand *hand, s32 handnum, struct weaponfunc *funcdef, s3
|
||||
|
||||
static inline f32 bgunGetFovOffsetZ(void)
|
||||
{
|
||||
return (videoGetPlayerFovY() - 60.f) / 3.f;
|
||||
return (g_PlayerDefaultFovY - 60.f) / 3.f;
|
||||
}
|
||||
|
||||
static inline f32 bgunGetFovOffsetY(void)
|
||||
{
|
||||
return (videoGetPlayerFovY() - 60.f) / (2.75f * 4.f);
|
||||
return (g_PlayerDefaultFovY - 60.f) / (2.75f * 4.f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+6
-6
@@ -1653,7 +1653,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
#ifdef PLATFORM_N64
|
||||
zoomfov = 60;
|
||||
#else
|
||||
zoomfov = videoGetPlayerFovY();
|
||||
zoomfov = g_PlayerDefaultFovY;
|
||||
#endif
|
||||
|
||||
// FarSight in secondary function
|
||||
@@ -1668,8 +1668,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
eraserfov = 60;
|
||||
}
|
||||
#else
|
||||
if (eraserfov > videoGetPlayerFovY()) {
|
||||
eraserfov = videoGetPlayerFovY();
|
||||
if (eraserfov > g_PlayerDefaultFovY) {
|
||||
eraserfov = g_PlayerDefaultFovY;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1711,7 +1711,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
#else
|
||||
if (zoomfov <= 0) {
|
||||
zoomfov = videoGetPlayerFovY();
|
||||
zoomfov = g_PlayerDefaultFovY;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1999,8 +1999,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
xscale = 1.f;
|
||||
yscale = 1.f;
|
||||
}
|
||||
x = g_Vars.currentplayer->speedtheta * 0.3f * crosshairSway * xscale + g_Vars.currentplayer->gunextraaimx;
|
||||
y = -g_Vars.currentplayer->speedverta * 0.1f * crosshairSway * yscale + g_Vars.currentplayer->gunextraaimy;
|
||||
x = g_Vars.currentplayer->speedtheta * 0.3f * g_PlayerCrosshairSway * xscale + g_Vars.currentplayer->gunextraaimx;
|
||||
y = -g_Vars.currentplayer->speedverta * 0.1f * g_PlayerCrosshairSway * yscale + g_Vars.currentplayer->gunextraaimy;
|
||||
#endif
|
||||
|
||||
bgunSwivelWithDamp(x, y, PAL ? 0.955f : 0.963f);
|
||||
|
||||
+12
-7
@@ -202,6 +202,11 @@ s16 g_DeathAnimations[] = {
|
||||
|
||||
s32 g_NumDeathAnimations = 0;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
f32 g_PlayerDefaultFovY = 60.f;
|
||||
f32 g_PlayerCrosshairSway = 1.f;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Choose which location to spawn into from the given pads. Write the position
|
||||
* and rooms to the dstpos and dstrooms pointers and return the angle that the
|
||||
@@ -2070,8 +2075,8 @@ void playerTweenFovY(f32 targetfovy)
|
||||
f32 speed = 15.0f / 30.0f;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
if (videoGetPlayerFovY() > 60.0f) { // adjust zoom speed depending on non-default fov setting (higher fov == faster zoom)
|
||||
speed /= videoGetPlayerFovY() / 60.0f;
|
||||
if (g_PlayerDefaultFovY > 60.0f) { // adjust zoom speed depending on non-default fov setting (higher fov == faster zoom)
|
||||
speed /= g_PlayerDefaultFovY / 60.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2696,7 +2701,7 @@ Gfx *playerRenderHealthBar(Gfx *gdl)
|
||||
#ifdef PLATFORM_N64
|
||||
mtx00016ae4(&matrix, 0, 370, 0, 0, 0, 0, 0, 0, -1);
|
||||
#else
|
||||
f32 fovsc = 60.f / videoGetPlayerFovY();
|
||||
f32 fovsc = 60.f / g_PlayerDefaultFovY;
|
||||
if (fovsc > 1.01f) {
|
||||
fovsc *= 1.1f;
|
||||
}
|
||||
@@ -3150,7 +3155,7 @@ void playerConfigureVi(void)
|
||||
#ifdef PLATFORM_N64
|
||||
playermgrSetFovY(60);
|
||||
#else
|
||||
playermgrSetFovY(videoGetPlayerFovY());
|
||||
playermgrSetFovY(g_PlayerDefaultFovY);
|
||||
#endif
|
||||
playermgrSetAspectRatio(ratio);
|
||||
playermgrSetViewSize(playerGetViewportWidth(), playerGetViewportHeight());
|
||||
@@ -3161,7 +3166,7 @@ void playerConfigureVi(void)
|
||||
#ifdef PLATFORM_N64
|
||||
viSetFovAspectAndSize(60, ratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
#else
|
||||
viSetFovAspectAndSize(videoGetPlayerFovY(), ratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
viSetFovAspectAndSize(g_PlayerDefaultFovY, ratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
#endif
|
||||
|
||||
viSetViewPosition(playerGetViewportLeft(), playerGetViewportTop());
|
||||
@@ -3228,7 +3233,7 @@ void playerTick(bool arg0)
|
||||
#ifdef PLATFORM_N64
|
||||
playermgrSetFovY(60);
|
||||
#else
|
||||
playermgrSetFovY(videoGetPlayerFovY());
|
||||
playermgrSetFovY(g_PlayerDefaultFovY);
|
||||
#endif
|
||||
playermgrSetAspectRatio(aspectratio);
|
||||
playermgrSetViewSize(playerGetViewportWidth(), playerGetViewportHeight());
|
||||
@@ -3238,7 +3243,7 @@ void playerTick(bool arg0)
|
||||
#ifdef PLATFORM_N64
|
||||
viSetFovAspectAndSize(60, aspectratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
#else
|
||||
viSetFovAspectAndSize(videoGetPlayerFovY(), aspectratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
viSetFovAspectAndSize(g_PlayerDefaultFovY, aspectratio, playerGetViewportWidth(), playerGetViewportHeight());
|
||||
#endif
|
||||
viSetViewPosition(playerGetViewportLeft(), playerGetViewportTop());
|
||||
viSetSize(playerGetFbWidth(), playerGetFbHeight());
|
||||
|
||||
@@ -528,5 +528,9 @@ extern struct menudialogdef g_HtDetailsMenuDialog;
|
||||
extern struct menudialogdef g_HtFailedMenuDialog;
|
||||
extern struct menudialogdef g_HtCompletedMenuDialog;
|
||||
extern struct menudialogdef g_HangarListMenuDialog;
|
||||
#ifndef PLATFORM_N64
|
||||
extern f32 g_PlayerCrosshairSway;
|
||||
extern f32 g_PlayerDefaultFovY;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -4,10 +4,6 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
extern f32 crosshairSway;
|
||||
#endif
|
||||
|
||||
void bmoveSetControlDef(u32 controldef);
|
||||
void bmoveSetAutoMoveCentreEnabled(bool enabled);
|
||||
void bmoveSetAutoAimY(bool enabled);
|
||||
|
||||
Reference in new issue
Block a user