Skip to content

Commit

Permalink
Fix up big oil tank explosions.
Browse files Browse the repository at this point in the history
Jesse tweaked these in a previous version but they were still nowhere
near as intense as they are in the original Sopwith 1/Sopwith 2. I got
the +4 value here from looking at Andrew Jenner's disassembly, and it
seems to match the DOS versions. As part of this, replace the command
line argument with a configuration variable for consistency.
  • Loading branch information
fragglet committed May 9, 2022
1 parent da3ed65 commit bc3f63e
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 33 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Bug fixes:
* Fix players able to turn quickly when wounded and using the autopilot.
* Damaged ground no longer remains on the title screen after the game ends.
* Network games no longer desync when only one player uses harry keys mode.
* Big oil tank explosions now match the magnitude of the old explosions from
Sopwith 1 and Sopwith 2. The command line option to disable them has been
replaced with a configuration variable.

Restructuring:

Expand Down
5 changes: 1 addition & 4 deletions doc/sopwith.6
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sopwith \- classic aerial combat shoot em up game

.SH SYNOPSIS
.B sopwith
[ \-n | \-s | \-c | \-l | \-j \fIhost\fR ] [\-f] [\-g\fIlevel\fR] [\-x] [\-q] [\-p] [\-e]
[ \-n | \-s | \-c | \-l | \-j \fIhost\fR ] [\-f] [\-g\fIlevel\fR] [\-x] [\-q] [\-p]

.SH DESCRIPTION
Sopwith is a modern port of the classic 1980s shoot 'em up game of the same
Expand Down Expand Up @@ -53,9 +53,6 @@ Turn off sound (quiet)
.TP
\-p
Turn on sound (play music)
.TP
\-e
Turn off intense explosions

.SH CONTROLS
The standard controls on a US layout keyboard are as follows:
Expand Down
6 changes: 6 additions & 0 deletions doc/sopwith.cfg.5
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ confusion that the direction of turning appears to "reverse" when the plane
is flipped / flying towards the left.
By default this is 0.
.TP
\fBconf_big_explosions\fR
If 1, oil tanks produce a huge explosion when destroyed. This reproduces the
behavior found in both "Sopwith 1" and "Sopwith 2", but the magnitude of the
explosion was dialed back significantly in the "Network Edition" release.
The default is 1.
.TP
\fBconf_medals\fR
If 1, medals are sometimes awarded to the player on return to base. Some
details can be found in the "MEDALS" section of \fBsopwith\fR(6). The medals
Expand Down
2 changes: 2 additions & 0 deletions src/swasynio.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ static void synchronize(void)
conf_missiles = readshort() != 0;
conf_wounded = readshort() != 0;
conf_animals = readshort() != 0;
conf_big_explosions = readshort() != 0;
} else {
// send settings
sendshort(explseed);
Expand All @@ -198,6 +199,7 @@ static void synchronize(void)
sendshort(conf_missiles);
sendshort(conf_wounded);
sendshort(conf_animals);
sendshort(conf_big_explosions);
}
}

Expand Down
50 changes: 28 additions & 22 deletions src/swconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ static char *GetConfigFilename(void)
}

static confoption_t confoptions[] = {
{"conf_missiles", CONF_BOOL, {&conf_missiles}},
{"conf_solidground", CONF_BOOL, {&conf_solidground}},
{"conf_hudsplats", CONF_BOOL, {&conf_hudsplats}},
{"conf_wounded", CONF_BOOL, {&conf_wounded}},
{"conf_animals", CONF_BOOL, {&conf_animals}},
{"conf_harrykeys", CONF_BOOL, {&conf_harrykeys}},
{"conf_medals", CONF_BOOL, {&conf_medals}},
{"vid_fullscreen", CONF_BOOL, {&vid_fullscreen}},
{"conf_missiles", CONF_BOOL, {&conf_missiles}},
{"conf_solidground", CONF_BOOL, {&conf_solidground}},
{"conf_hudsplats", CONF_BOOL, {&conf_hudsplats}},
{"conf_wounded", CONF_BOOL, {&conf_wounded}},
{"conf_animals", CONF_BOOL, {&conf_animals}},
{"conf_harrykeys", CONF_BOOL, {&conf_harrykeys}},
{"conf_big_explosions", CONF_BOOL, {&conf_big_explosions}},
{"conf_medals", CONF_BOOL, {&conf_medals}},
{"vid_fullscreen", CONF_BOOL, {&vid_fullscreen}},

{"key_accelerate", CONF_KEY, {&keybindings[KEY_ACCEL]}},
{"key_decelerate", CONF_KEY, {&keybindings[KEY_DECEL]}},
Expand Down Expand Up @@ -301,7 +302,7 @@ static void change_key_binding(struct menuitem *item)

static void drawmenu(char *title, struct menuitem *menu)
{
int i, keynum, said_key = 0;
int i, y, keynum, said_key = 0;
Vid_ClearBuf();

swcolor(2);
Expand All @@ -310,7 +311,7 @@ static void drawmenu(char *title, struct menuitem *menu)

swcolor(3);

for (i=0, keynum=0; menu[i].config_name != NULL; ++i) {
for (i=0, y=0, keynum=0; menu[i].config_name != NULL; ++i, ++y) {
confoption_t *opt;
char *suffix;
char buf[40];
Expand All @@ -330,19 +331,23 @@ static void drawmenu(char *title, struct menuitem *menu)
suffix = ":";

if (!said_key) {
swposcur(1, 5+i);
swposcur(0, 5+y);
swputs("Key:");
said_key = 1;
}
}
snprintf(buf, sizeof(buf), "%c - %s%s",
key, menu[i].description, suffix);

swposcur(6, 5+i);
swposcur(5, 5+y);
swputs(buf);
swcolor(3);

swposcur(28, 5+i);
if (strlen(buf) > 22) {
++y;
}

swposcur(28, 5+y);
opt = confoption_by_name(menu[i].config_name);
if (opt == NULL) {
continue;
Expand Down Expand Up @@ -457,15 +462,16 @@ struct menuitem keys_menu[] = {
};

struct menuitem options_menu[] = {
{"vid_fullscreen", "Run fullscreen"},
{"conf_solidground", "Solid ground"},
{"conf_hudsplats", "HUD splats"},
{"conf_wounded", "Wounded planes"},
{"conf_animals", "Oxen and birds"},
{"conf_medals", "Medals"},
{"conf_harrykeys", "Harry keys mode"},
{"", ""},
{">K", "Key bindings"},
{"vid_fullscreen", "Run fullscreen"},
{"conf_solidground", "Solid ground"},
{"conf_hudsplats", "HUD splats"},
{"conf_wounded", "Wounded planes"},
{"conf_animals", "Oxen and birds"},
{"conf_big_explosions", "Big oil tank explosions"},
{"conf_medals", "Medals"},
{"conf_harrykeys", "Harry keys mode"},
{"", ""},
{">K", "Key bindings"},
{NULL},
};

Expand Down
14 changes: 7 additions & 7 deletions src/swinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
static int have_savescore = 0;
static score_t savescore; /* save players score on restart */
static int starting_level = 0;
static int conf_explosions = 1;

static char helptxt[] =
"\n"
Expand Down Expand Up @@ -700,10 +699,13 @@ void initexpl(OBJECTS * obop, int small)
obotype = obo->ob_type;
if (obotype == TARGET && obo->ob_orient == 2) {
ic = 1;
// adding in option here for large oil tank explosions
// - Jesse
if (conf_explosions) {
speed = gminspeed * 4 / 3;
// sdh: Oil tank explosions were changed in Sopwith "Network
// Edition" to be much less intense; we make this change
// optional. I believe +4 here is correct, because the amj
// decompile says something like "speed = level + 8" and
// gminspeed = level + MIN_SPEED = level + 4.
if (conf_big_explosions) {
speed = gminspeed + 4;
} else {
speed = gminspeed;
}
Expand Down Expand Up @@ -1049,8 +1051,6 @@ void swinit(int argc, char *argv[])
soundflg = 1;
} else if (!strcasecmp(argv[i], "-p")) {
soundflg = 0;
} else if (!strcasecmp(argv[i], "-e")) {
conf_explosions = 0;
} else
#ifdef TCPIP
if (!strcasecmp(argv[i], "-l")) {
Expand Down
1 change: 1 addition & 0 deletions src/swmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ BOOL conf_wounded = 0; // enable wounded planes
BOOL conf_animals = 1; // birds and oxen
BOOL conf_harrykeys = 0; // plane rotation relative to screen
BOOL conf_medals = 1;
BOOL conf_big_explosions = 1; // big oil tank explosions

playmode_t playmode; /* Mode of play */
GAMES *currgame; /* Game parameters and current game */
Expand Down
1 change: 1 addition & 0 deletions src/swmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern BOOL conf_wounded;
extern BOOL conf_animals;
extern BOOL conf_harrykeys;
extern BOOL conf_medals;
extern BOOL conf_big_explosions;

extern OBJECTS *consoleplayer;
extern playmode_t playmode;
Expand Down

0 comments on commit bc3f63e

Please sign in to comment.