Skip to content

Commit ac79f0e

Browse files
committed
Merge github.com:Interrupt/systemshock into glfilter
resolved conflicts: src/GameSrc/wrapper.c
2 parents 1aa49e6 + 2ab662f commit ac79f0e

6 files changed

Lines changed: 73 additions & 41 deletions

File tree

src/GameSrc/Headers/wrapper.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,28 @@ extern char comments[NUM_SAVE_SLOTS][SAVE_COMMENT_LEN];
8181
save_game_name[7] = '0' + (game_num & 7); \
8282
}
8383

84+
enum TEMP_STR_ {
85+
REF_STR_Renderer = 0x10000000,
86+
REF_STR_Software,
87+
REF_STR_OpenGL,
88+
89+
REF_STR_TextFilt = 0x10000010,
90+
REF_STR_TFUnfil, // unfiltered
91+
REF_STR_TFBilin, // bilinear
92+
93+
REF_STR_MousLook = 0x11000000,
94+
REF_STR_MousNorm,
95+
REF_STR_MousInv,
96+
97+
REF_STR_Seqer = 0x20000000,
98+
REF_STR_ADLMIDI,
99+
REF_STR_NativeMI,
100+
#ifdef USE_FLUIDSYNTH
101+
REF_STR_FluidSyn,
102+
#endif // USE_FLUIDSYNTH
103+
REF_STR_MidiOut = 0x2fffffff,
104+
105+
REF_STR_MidiOutX = 0x30000000 // 0x30000000-0x3fffffff are MIDI outputs
106+
};
107+
84108
#endif // __WRAPPER_H

src/GameSrc/mouselook.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "physics.h"
66
#include "froslew.h"
77
#include "objsim.h"
8+
#include "Prefs.h"
9+
810
#include <stdio.h>
911
#include <SDL.h>
1012

@@ -45,7 +47,7 @@ void mouse_look_physics() {
4547
} else {
4648
// player head controls
4749
mvelx *= -mlook_hsens;
48-
mvely *= -mlook_vsens;
50+
mvely *= (gShockPrefs.goInvertMouseY ? mlook_vsens : -mlook_vsens);
4951

5052
if (mvely != 0) {
5153
// Moving the eye up angle is easy

src/GameSrc/wrapper.c

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -358,48 +358,39 @@ uchar fv;
358358
// override get_temp_string() to support hard-coded custom strings without
359359
// providing an actual resource file
360360

361-
#define REF_STR_Renderer 0x10000000
362-
#define REF_STR_Software 0x10000001
363-
#define REF_STR_OpenGL 0x10000002
364-
#define REF_STR_TEXTFILT 0x10000010
365-
#define REF_STR_TFUNFIL 0x10000011 // unfiltered
366-
#define REF_STR_TFBILIN 0x10000012 // bilinear
367-
368-
#define REF_STR_Seqer 0x20000000
369-
#define REF_STR_ADLMIDI 0x20000001
370-
#define REF_STR_NativeMI 0x20000002
371-
#define REF_STR_FluidSyn 0x20000003 // this has to be last because it is optional
372-
#define REF_STR_MidiOut 0x2fffffff
373-
374-
#define REF_STR_MidiOutX 0x30000000 // 0x30000000-0x3fffffff are MIDI outputs
375-
376-
#define MIDI_OUT_BUFFER_SIZE 1024
377-
static char MIDI_OUT_BUFFER[MIDI_OUT_BUFFER_SIZE];
361+
#define MIDI_OUT_STR_SIZE 1024
362+
static char MIDI_STR_BUFFER[MIDI_OUT_STR_SIZE];
378363

379364
static char *_get_temp_string(int num) {
380365
switch (num) {
381366
case REF_STR_Renderer: return "Renderer";
382367
case REF_STR_Software: return "Software";
383368
case REF_STR_OpenGL: return "OpenGL";
384369

385-
case REF_STR_TEXTFILT: return "Tex Filter";
386-
case REF_STR_TFUNFIL: return "Unfiltered";
387-
case REF_STR_TFBILIN: return "Bilinear";
370+
case REF_STR_TextFilt: return "Tex Filter";
371+
case REF_STR_TFUnfil: return "Unfiltered";
372+
case REF_STR_TFBilin: return "Bilinear";
373+
374+
case REF_STR_MousLook: return "Mouselook";
375+
case REF_STR_MousNorm: return "Normal";
376+
case REF_STR_MousInv: return "Inverted";
388377

389378
case REF_STR_Seqer: return "Midi Player";
390379
case REF_STR_ADLMIDI: return "ADLMIDI";
391380
case REF_STR_NativeMI: return "Native MIDI";
381+
#ifdef USE_FLUIDSYNTH
392382
case REF_STR_FluidSyn: return "FluidSynth";
383+
#endif
393384

394385
case REF_STR_MidiOut: return "Midi Output";
395386
}
396387

397388
if (num >= REF_STR_MidiOutX && num <= (REF_STR_MidiOutX | 0x0fffffff))
398389
{
399390
const unsigned int midiOutputIndex = (unsigned int)num - REF_STR_MidiOutX;
400-
MIDI_OUT_BUFFER[0] = '\0';
401-
GetOutputNameXMI(midiOutputIndex, &MIDI_OUT_BUFFER[0], MIDI_OUT_BUFFER_SIZE);
402-
return &MIDI_OUT_BUFFER[0];
391+
MIDI_STR_BUFFER[0] = '\0';
392+
GetOutputNameXMI(midiOutputIndex, &MIDI_STR_BUFFER[0], MIDI_OUT_STR_SIZE);
393+
return &MIDI_STR_BUFFER[0];
403394
}
404395

405396
return get_temp_string(num);
@@ -1491,14 +1482,9 @@ void soundopt_screen_init() {
14911482
i++;
14921483
#endif
14931484

1494-
#ifdef USE_FLUIDSYNTH
1495-
const uchar numSynths = 3;
1496-
#else
1497-
const uchar numSynths = 2;
1498-
#endif
14991485
standard_button_rect(&r, i, 2, 2, 5);
15001486
multi_init(i, 'p', REF_STR_Seqer, REF_STR_ADLMIDI, ID_NULL,
1501-
sizeof(gShockPrefs.soMidiBackend), &gShockPrefs.soMidiBackend, numSynths, seqer_dealfunc, &r);
1487+
sizeof(gShockPrefs.soMidiBackend), &gShockPrefs.soMidiBackend, OPT_SEQ_Max, seqer_dealfunc, &r);
15021488
i++;
15031489
/* standard button is too narrow, so use a slider instead
15041490
const unsigned int numMidiOutputs = GetOutputCountXMI();
@@ -1852,9 +1838,6 @@ void input_screen_init(void) {
18521838
mousehand_dealfunc, &r);
18531839
i++;
18541840

1855-
standard_button_rect(&r, 5, 2, 2, 1);
1856-
pushbutton_init(RETURN_BUTTON, keys[3], REF_STR_OptionsText + 5, wrapper_pushbutton_func, &r);
1857-
18581841
standard_slider_rect(&r, i, 2, 1);
18591842
r.ul.x -= 1;
18601843
sliderbase = ((r.lr.x - r.ul.x - 3) * (FIX_UNIT / 3)) / USHRT_MAX;
@@ -1867,6 +1850,15 @@ void input_screen_init(void) {
18671850
pushbutton_init(i, keys[2], REF_STR_Joystick, joystick_button_func, &r);
18681851
i++;
18691852

1853+
standard_button_rect(&r, i, 2, 2, 1);
1854+
r.ul.x -= 1;
1855+
multi_init(i, keys[3], REF_STR_MousLook, REF_STR_MousNorm, ID_NULL,
1856+
sizeof(gShockPrefs.goInvertMouseY), &gShockPrefs.goInvertMouseY, 2, NULL, &r);
1857+
i++;
1858+
1859+
standard_button_rect(&r, 5, 2, 2, 1);
1860+
pushbutton_init(RETURN_BUTTON, keys[3], REF_STR_OptionsText + 5, wrapper_pushbutton_func, &r);
1861+
18701862
// FIXME: Cannot pass a keycode with modifier flags as uchar
18711863
keywidget_init(QUIT_BUTTON, /*KB_FLAG_ALT |*/ 'x', wrapper_pushbutton_func);
18721864

@@ -1944,7 +1936,7 @@ void video_screen_init(void) {
19441936
// textre filter
19451937
if(can_use_opengl() && gShockPrefs.doUseOpenGL) {
19461938
standard_button_rect(&r, i, 2, 2, 2);
1947-
multi_init(i, 't', REF_STR_TEXTFILT, REF_STR_TFUNFIL, ID_NULL,
1939+
multi_init(i, 't', REF_STR_TextFilt, REF_STR_TFUnfil, ID_NULL,
19481940
sizeof(gShockPrefs.doTextureFilter), &gShockPrefs.doTextureFilter, 2, renderer_dealfunc, &r);
19491941
i++;
19501942
}

src/MacSrc/Prefs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern uchar audiolog_setting;
6767

6868
static const char *PREF_LANGUAGE = "language";
6969
static const char *PREF_CAPTUREMOUSE = "capture-mouse";
70+
static const char *PREF_INVERTMOUSEY = "invert-mousey";
7071
static const char *PREF_MUSIC_VOL = "music-volume";
7172
static const char *PREF_SFX_VOL = "sfx-volume";
7273
static const char *PREF_ALOG_VOL = "alog-volume";
@@ -106,6 +107,7 @@ void SetDefaultPrefs(void) {
106107

107108
gShockPrefs.goLanguage = 0; // English
108109
gShockPrefs.goCaptureMouse = true;
110+
gShockPrefs.goInvertMouseY = false;
109111
gShockPrefs.soMusicVolume = 75;
110112
gShockPrefs.soSfxVolume = 100;
111113
gShockPrefs.soAudioLogVolume = 100;
@@ -180,6 +182,8 @@ OSErr LoadPrefs(void) {
180182
gShockPrefs.goLanguage = lang;
181183
} else if (strcasecmp(key, PREF_CAPTUREMOUSE) == 0) {
182184
gShockPrefs.goCaptureMouse = is_true(value);
185+
} else if (strcasecmp(key, PREF_INVERTMOUSEY) == 0) {
186+
gShockPrefs.goInvertMouseY = is_true(value);
183187
} else if (strcasecmp(key, PREF_MUSIC_VOL) == 0) {
184188
int vol = atoi(value);
185189
if (vol >= 0 && vol <= 100) {
@@ -257,6 +261,7 @@ OSErr SavePrefs(void) {
257261

258262
fprintf(f, "%s = %d\n", PREF_LANGUAGE, which_lang);
259263
fprintf(f, "%s = %s\n", PREF_CAPTUREMOUSE, gShockPrefs.goCaptureMouse ? "yes" : "no");
264+
fprintf(f, "%s = %s\n", PREF_INVERTMOUSEY, gShockPrefs.goInvertMouseY ? "yes" : "no");
260265
fprintf(f, "%s = %d\n", PREF_MUSIC_VOL, curr_vol_lev);
261266
fprintf(f, "%s = %d\n", PREF_SFX_VOL, sfx_on ? curr_sfx_vol : 0);
262267
fprintf(f, "%s = %d\n", PREF_ALOG_VOL, curr_alog_vol);
@@ -294,12 +299,8 @@ static void SetShockGlobals(void) {
294299
_fr_global_detail = gShockPrefs.doDetail;
295300
}
296301

297-
298-
299302
//************************************************************************************
300303

301-
302-
303304
//********
304305
//Keybinds
305306
//********

src/MacSrc/Prefs.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ typedef struct {
3939
Boolean goOnScreenHelp;
4040
short goLanguage; // 0 - English, 1 - French, 2 - German
4141
Boolean goCaptureMouse;
42+
Boolean goInvertMouseY;
4243

4344
// Sound Options
4445
Boolean soBackMusic;
@@ -73,3 +74,15 @@ extern ShockPrefs gShockPrefs;
7374
void SetDefaultPrefs(void);
7475
OSErr LoadPrefs(void);
7576
OSErr SavePrefs(void);
77+
78+
//-------------------
79+
// Enums
80+
//-------------------
81+
enum OPT_SEQ_ { // Must be in the same order as in wraper.h
82+
OPT_SEQ_ADLMIDI = 0,
83+
OPT_SEQ_NativeMI,
84+
#ifdef USE_FLUIDSYNTH
85+
OPT_SEQ_FluidSyn,
86+
#endif // USE_FLUIDSYNTH
87+
OPT_SEQ_Max
88+
};

src/MacSrc/Xmi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,20 +661,20 @@ void InitDecXMI(void)
661661

662662
switch (gShockPrefs.soMidiBackend)
663663
{
664-
case 0: // adlmidi
664+
case OPT_SEQ_ADLMIDI: // adlmidi
665665
{
666666
INFO("Creating ADLMIDI device");
667667
musicdev = CreateMusicDevice(Music_AdlMidi);
668668
}
669669
break;
670-
case 1: // native midi
670+
case OPT_SEQ_NativeMI: // native midi
671671
{
672672
INFO("Creating native MIDI device");
673673
musicdev = CreateMusicDevice(Music_Native);
674674
}
675675
break;
676676
#ifdef USE_FLUIDSYNTH
677-
case 2: // fluidsynth
677+
case OPT_SEQ_FluidSyn: // fluidsynth
678678
{
679679
INFO("Creating FluidSynth MIDI device");
680680
musicdev = CreateMusicDevice(Music_FluidSynth);

0 commit comments

Comments
 (0)