Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix game scaling #910

Merged
merged 14 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/objconv/basemaker/base_maker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2166,8 +2166,8 @@ int main(int argc, char **argv) {
Base::CurrentBase = NULL;
glutInit(&argc, argv);
glutInitWindowSize(800, 600);
g_game.x_resolution = 800;
g_game.y_resolution = 600;
g_game.x_resolution = 1920;
g_game.y_resolution = 1080;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably be in variables/constants and match L2168. (1920, 1080) is outside the window defined by L2168.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan (fairly advanced actually) is to move all settings in the engine to an automatically generated and populated singleton. That would deprecate a huge chunk of code, from settings, configuration, all those XMLParser lines, etc.

The JSON parser would convert directly to the filetype and you'd work against a variable. https://github.com/royfalk/JsonStruct has the script to generate this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@royfalk that's fine - just calling out the potential bug due to the the window size not matching here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. I guess I need to figure out what objconv does. It's not part of the main game,as far as I can tell. I'm also not convinced we are using glutInit in the actual game. I think both SDL and glut were supported and I picked SDL.

This lack of focus by the original devs... well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least when working with Qt, the coordinate system worked in two parts:

  1. Canvas that everything was drawn against
  2. View Port for what on the canvas to show the user
  3. Device Canvas that laid out the hardware

It gave some interesting effects. So technically, those coordinates exist but they may be outside the view port; but that's probably not what we want.

glutInitWindowPosition(0, 0);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Vega Strike Base Maker");
Expand Down
4 changes: 2 additions & 2 deletions engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ void setup_game_data() {
g_game.music_volume = 1;
g_game.warning_level = 20;
g_game.capture_mouse = GFXFALSE;
g_game.y_resolution = 768;
g_game.x_resolution = 1024;
g_game.y_resolution = 1080;
g_game.x_resolution = 1920;
g_game.fov = 78;
g_game.MouseSensitivityX = 2;
g_game.MouseSensitivityY = 4;
Expand Down
5 changes: 3 additions & 2 deletions engine/src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "options.h"
#include "configxml.h"
#include "configuration/configuration.h"

extern VegaConfig *vs_config;

Expand Down Expand Up @@ -189,8 +190,8 @@ void vs_options::init() {
rgb_pixel_format = vs_config->getVariable("graphics", "rgb_pixel_format", "undefined");
gl_accelerated_visual = XMLSupport::parse_bool(vs_config->getVariable("graphics", "gl_accelerated_visual", "true"));
z_pixel_format = XMLSupport::parse_int(vs_config->getVariable("graphics", "z_pixel_format", "24"));
x_resolution = XMLSupport::parse_int(vs_config->getVariable("graphics", "x_resolution", "1024"));
y_resolution = XMLSupport::parse_int(vs_config->getVariable("graphics", "y_resolution", "768"));
x_resolution = configuration()->graphics2_config.resolution_x;
y_resolution = configuration()->graphics2_config.resolution_y;
fullscreen = XMLSupport::parse_bool(vs_config->getVariable("graphics", "fullscreen", "false"));
colordepth = XMLSupport::parse_int(vs_config->getVariable("graphics", "colordepth", "32"));
glut_stencil = XMLSupport::parse_bool(vs_config->getVariable("graphics", "glut_stencil", "true"));
Expand Down
Loading