From 1362a93b4d9b8f644ab4715b36836516bcc48b2f Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Mon, 2 Jun 2025 16:58:02 +0200 Subject: [PATCH] Add quality presets --- TODO.txt | 1 + data | 8 ++++---- frontend_csfml.c | 6 ++++-- frontend_helper.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ frontend_sdl.c | 6 +++++- frontend_x11.c | 6 +++++- media/manual.txt | 18 +++++++++--------- 7 files changed, 72 insertions(+), 17 deletions(-) diff --git a/TODO.txt b/TODO.txt index 8991dae..c942dbd 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,6 +2,7 @@ fuck issue trackers :D =========== GENERAL ============== +- set target times for maps - frontends: - auto test frontend, with no I/O, that will just internally run a series of inputs and check if the output is as expected diff --git a/data b/data index d2bdc51..8757db8 100644 --- a/data +++ b/data @@ -132,14 +132,14 @@ details :-e5g :f413 :|g0hL :+018 :f213 :!v05 :f311 #RLC1 00'15'147;00LC1;8bd6e314 0000459:0001:00c9:0041:0039:0041:01c9:0071:0039:0051:0059:0011:0029:0051:0189:0061:0055:0021:0039:0161:0069:0051:0089:0041:0039:0041:0243:0041:02b5:0021:0123:0031:0073:0051:0023:0101:0083:0031:00a3:0031:00a9:0031:0569:0011:0059:0021:00d3:0021 -#RLC2 00'24'684;00LC2;3c5ba5dd 0000748:0001:00d3:0041:0209:0041:0095:0041:0059:01f1:01b9:0061:0029:0051:0143:0031:00b3:0091:0043:0051:00f3:0071:0053:0031:0033:0031:00a3:0041:01b9:0011:01a9:0011:0109:0041:0035:0031:0059:0031:0033:00f1:00c3:0091:0083:0021:0033:0031:0063:0041:0063:0021:00b9:0091:00a9:00d1:0069:0021:00c9:0041:0143:0101:0139:0021:0233:00a7:0035:0014:00a6:0041:0073:0072:0053:00f1:0079:0081:01b9:0041:0133:0031:00d9:0021:00c3:0011:0099:0031:0073:0031 +#RLC2 00'24'354;00LC2;3c5ba5dd 0000738:0001:00d3:0051:01a9:0041:0115:0031:01e9:0041:0049:0041:0049:0021:0069:0051:0039:0021:00c3:0041:00b9:0021:0073:0031:0023:0031:0053:0091:0073:00a1:0013:0081:00a3:0021:0369:0011:02a5:0031:0053:0031:0033:00e1:00a3:00b1:0113:0021:00c9:0031:0059:0031:00e9:0061:0069:0091:0213:0101:0073:0031:00c9:0011:0069:0061:0053:0041:0113:0077:0076:0052:0123:0131:0323:0041:03a9:0031 #RLC3 00'16'566;00LC3;cb1b38e6 0000502:0001:00b3:0031:00e9:0031:0104:0125:0031:0153:0071:0063:0031:0053:0021:0043:0051:0023:0031:0053:0071:0083:0041:0053:0031:0143:0071:0033:0061:00d9:01c1:0039:0041:0033:0021:0033:0051:0053:0061:0043:0021:00b3:0061:00c3:0081:0053:0021:00d3:0041:0133:00c1:0039:0091:0119:0031:0133:0031:01b5:0041 -#RLC4 00'25'773;00LC4;bcf27d79 0000781:0001:00f9:0221:0073:0051:00f9:0031:0099:0041:0059:0031:0353:0051:0099:0041:00a3:0051:00c9:0051:0053:0071:0043:0051:0043:00a1:00a3:0051:00c3:0031:0149:0081:00a3:0111:0049:0151:0083:00e1:0049:0041:0039:0011:0063:0031:00f3:0041:00d3:00a1:0099:0021:00f3:0041:0063:0031:04b5:0031:00c9:0011:00b9:0031:0083:0071:0023:0071:0043:0041:0049:0031:0153:0031:0243:0051:0089:0071:00c3:0031 +#RLC4 00'25'443;00LC4;bcf27d79 0000771:0001:00d9:0071:0029:00c1:00c9:0031:0329:0021:00f3:0031:00a9:0011:00c9:0011:00d5:0031:00a9:0031:00e3:0041:00d3:0031:0039:0091:0029:0061:0059:0031:0069:0061:0029:0041:01c3:0021:0089:0021:0253:0021:0183:0011:0159:0091:0069:0031:0079:0051:00b2:0071:0079:0061:0093:0051:0183:0041:00b9:0041:00d9:0071:0073:0091:0119:0041:0053:0051:0039:0071:0039:0021:0039:0021:0053:0051:0079:0081:0049:0071:0083:0021:0059:0031:00c3:0031:00b9:0021:0039:0031:02a9:0021:0063:0041:0123:0021:0073:0021 #RLC5 00'25'971;00LC5;90f26004 0000787:0001:0023:0071:0063:0031:0155:0031:0139:0031:01d9:0021:0179:0031:0064:006c:0038:0029:0171:0063:0091:0033:0061:00e9:0041:0029:0031:0093:0081:0079:0091:00a9:0051:0019:0061:0039:0031:0099:0031:0029:0041:0089:0041:0029:0031:0049:0031:0019:0071:0029:0031:0193:0031:00a3:0021:00d3:0051:0063:0021:0139:0068:001c:0070:0028:0059:00b1:0033:00d1:0043:0041:0043:0051:0319:00d1:0043:0051:0189:0061:0029:0031:0099:0031:00b5:0051:00c9:0051:0039:0051:0049:0061:0039:0041:0169:0051:0105:0031:01f3:0031:0053:0012:0076:0062:0043:0101:00b9:0021 -#RLCtiny1 00'12'276;00LCtiny1;ae1ab677 0000372:0001:02e9:0021:01e9:0051:00c9:0151:0073:0091:0059:0051:0073:0041:00a9:0031:0033:0031:0063:0031:0063:0021:0023:0087:0073:0131:0023:00a1:0069:0091:0103:0031:0205:0021:00b3:0091:0113:0021:00b9:0031:0053:0051:0039 +#RLCtiny1 00'09'900;00LCtiny1;ae1ab677 0000300:0001:0179:0031:0299:0021:0129:0075:0031:0029:0031:0039:0041:0049:0021:0079:0051:00f3:0041:0033:0021:0053:00b5:0017:0033:0151:0069:0051:0033:0071:0033:0031:0115:0017:0015:0021:0073:0041:0063:0031:0053:0021:0063:0051:0099:0031:0073:0031 #RLCtiny2 00'05'181;00LCtiny2;833ee4b2 0000157:0011:0320:0034:00a0:00d4:00f0 #RLCtiny3 00'11'880;00LCtiny3;df0bd8ce 0000360:0001:00c3:0031:00d3:0031:00e9:0031:00e9:0041:0069:0021:0059:0021:00c3:0041:0233:0041:0159:0251:0113:0031:01a3:0031:0143:0021:00a9:0021:00d3:0041:0253:0031:00a3:0041 #RLCtiny4 00'05'280;00LCtiny4;f999f0ec 0000160:0003:01d1:0019:01f1:0119:0061:0109:0041:0209:0041 #RLCtiny5 00'08'811;00LCtiny5;5c14d8b6 0000267:0001:00f9:0041:0139:00b1:0109:0041:0049:0021:0103:0151:0083:0061:0069:0081:0093:0031:0083:00d1:0083:0031:0143:0021:0175:0021:0109:0031 -#RLCbonus1 00'14'256;00LCbonus1;999b1acd 0000432:0001:0129:0051:0059:0011:00d3:0021:0169:0081:0013:0121:0049:0051:0033:0031:0093:0091:00c9:01f1:00c9:0061:0153:0031:0189:00c1:00e9:0021:01d9:0031:0159:0028:0020:0014:003c:0014:0020:0028:0059:0061:0079:0021:0049:00a1:0089:0041:0029:0031:0089:0011:0079:0068:0020:0038:0020:0028:0099:0041:0083 +#RLCbonus1 00'13'629;00LCbonus1;999b1acd 0000413:0001:00d9:0051:0113:0031:0069:0021:00a9:0031:0049:0041:0039:0051:0043:0121:0053:0061:0083:0021:0083:0041:0079:01b1:0059:0041:0049:0021:00e9:0031:0063:0041:0169:00c1:03e9:0038:0020:0081:0119:00b1:00c9:0041:0079:0041:0039:0051:0039:0058:0179:0031 #RLCbonus2 00'26'103;00LCbonus2;288d28fe 0000791:0001:0163:0101:0053:0021:00c3:0071:0063:0031:0059:00b8:0050:0034:0016:00f4:003c:00a4:00a6:0044:0056:0024:00a6:0112:0020:0029:0071:00d9:0031:0053:0091:0113:0061:00b5:0049:0101:00a3:00c2:0083:0101:0029:0051:0183:0041:0063:0041:00c3:0041:0119:0051:0019:0041:0055:0049:0018:0099:0031:0052:0023:0022:0023:0052:0073:0041:0070:0032:0046:00e4:0010:0038:0069:00a8:0139:0078:0079:00ac:0014:006c:0078:0010:0061:0079:00a1:0063:0031:0133:0031:0030:0058:002c:0018:0190:0022:0026:0030:0062:0010:0028:0029:0121:0043:0062:0020:0042:0053:00b1:0175:004c:0018:0080:0061:0033:0031:0022:0093:0011:0020:0018:0069 diff --git a/frontend_csfml.c b/frontend_csfml.c index 5454c98..fbc44de 100644 --- a/frontend_csfml.c +++ b/frontend_csfml.c @@ -9,10 +9,12 @@ #include #include -#define DATA_FILE_NAME "data" +#ifndef PRESET_QUALITY + #define PRESET_QUALITY 3 +#endif -#include "game.h" #include "frontend_helper.h" +#include "game.h" #define WINDOW_SIZE (LCR_SETTING_RESOLUTION_X * LCR_SETTING_RESOLUTION_Y) diff --git a/frontend_helper.h b/frontend_helper.h index a0f249b..6c88473 100644 --- a/frontend_helper.h +++ b/frontend_helper.h @@ -6,6 +6,50 @@ // TODO: quality presets? +#if PRESET_QUALITY == 1 // ultra low + #define LCR_SETTING_RESOLUTION_X 256 + #define LCR_SETTING_RESOLUTION_Y 200 + #define LCR_SETTING_POTATO_GRAPHICS 1 + #define LCR_SETTING_332_COLOR 1 + #define LCR_SETTING_FPS 25 + #define LCR_SETTING_CAR_SHADOW 0 + #define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 0 + #define LCR_SETTING_PARTICLES 0 + #define LCR_SETTING_TEXTURE_SUBSAMPLE 16 + #define LCR_SETTING_FOG 0 + #define LCR_SETTING_MUSIC 0 +#elif PRESET_QUALITY == 2 // low + #define LCR_SETTING_RESOLUTION_X 512 + #define LCR_SETTING_RESOLUTION_Y 400 + #define LCR_SETTING_RESOLUTION_SUBDIVIDE 2 + #define LCR_SETTING_CAR_SHADOW 0 + #define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 0 + #define LCR_SETTING_PARTICLES 0 + #define LCR_SETTING_TEXTURE_SUBSAMPLE 8 + #define LCR_SETTING_FOG 0 + #define LCR_SETTING_FPS 30 +#elif PRESET_QUALITY == 3 // normal + #define LCR_SETTING_RESOLUTION_X 800 + #define LCR_SETTING_RESOLUTION_Y 600 + #define LCR_SETTING_RESOLUTION_SUBDIVIDE 1 + #define LCR_SETTING_CAR_SHADOW 1 + #define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 1 + #define LCR_SETTING_PARTICLES 1 + #define LCR_SETTING_TEXTURE_SUBSAMPLE 4 + #define LCR_SETTING_FOG 0 + #define LCR_SETTING_FPS 30 +#elif PRESET_QUALITY == 4 // high + #define LCR_SETTING_RESOLUTION_X 1024 + #define LCR_SETTING_RESOLUTION_Y 768 + #define LCR_SETTING_RESOLUTION_SUBDIVIDE 1 + #define LCR_SETTING_CAR_SHADOW 1 + #define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 1 + #define LCR_SETTING_PARTICLES 1 + #define LCR_SETTING_TEXTURE_SUBSAMPLE 1 + #define LCR_SETTING_FOG 1 + #define LCR_SETTING_FPS 45 +#endif + #include #include diff --git a/frontend_sdl.c b/frontend_sdl.c index ee2cf3a..22daf23 100644 --- a/frontend_sdl.c +++ b/frontend_sdl.c @@ -17,10 +17,14 @@ #define LCR_SETTING_CAR_SHADOW 0 #define LCR_SETTING_TEXTURE_SUBSAMPLE 4 #define LCR_SETTING_RESOLUTION_SUBDIVIDE 2 +#else + #ifndef PRESET_QUALITY + #define PRESET_QUALITY 3 + #endif #endif -#include "game.h" #include "frontend_helper.h" +#include "game.h" SDL_Window *window; SDL_Renderer *renderer; diff --git a/frontend_x11.c b/frontend_x11.c index a48386f..1de2b45 100644 --- a/frontend_x11.c +++ b/frontend_x11.c @@ -15,8 +15,12 @@ #define LCR_SETTING_RESOLUTION_Y 240 #define LCR_SETTING_MUSIC 0 -#include "game.h" +#ifndef PRESET_QUALITY + #define PRESET_QUALITY 3 +#endif + #include "frontend_helper.h" +#include "game.h" char framebuffer[LCR_SETTING_RESOLUTION_X * LCR_SETTING_RESOLUTION_Y * 4]; uint8_t buttonStates[8]; diff --git a/media/manual.txt b/media/manual.txt index c6d021c..7c01a9f 100644 --- a/media/manual.txt +++ b/media/manual.txt @@ -323,18 +323,18 @@ at times. Lowering the resolution should generally help, also increasing S3L_NEAR in renderer.h should prevent this (but it will have some consequences). If it seems real significant, you can report this to me. -Q: I found a bug or have some other important comment. +Q: I found a bug and/or have some other important comment. + A: Send me an email (found on top of this file). Q: I have some other question (such as "Why is this not written in a modern language?" or "What inspired you to make the game?" etc.) A: Many questions I often get asked about my life and/or programming philosophy -can't now be answered in a tl;dr way without doing them injustice. I have a -website at http://www.tastyfish.cz, where I attempt to explain things, but -please note you will probably not like it. If you still decide to follow the -link and don't find your answer, feel to ask me anything over email, but please -remember I am not very social and don't enjoy too much engaging in smalltalk or -lengthy discussions about worldviews etcetc. I am certainly not interested in -having my opinions changed or changing someone else's mind by force. - +can't now be answered in a tl;dr while doing them injustice. I have a website at +http://www.tastyfish.cz, where I attempt to explain things, but please note you +will probably not like it. If you still decide to follow the link and don't find +your answer, feel to ask me anything over email, but please remember I am not +very social and don't enjoy too much engaging in smalltalk or lengthy +discussions about worldviews etcetc. I am certainly not interested in having my +opinions changed or changing someone else's mind by force.