Skip to content

Commit

Permalink
Merge pull request #523 from DescentDevelopers/windows-fix
Browse files Browse the repository at this point in the history
Fixes for Windows build
  • Loading branch information
Lgt2x authored Aug 12, 2024
2 parents 7337320 + f888a10 commit bda97fc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 39 deletions.
11 changes: 3 additions & 8 deletions Descent3/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,20 +1635,15 @@ bool DoMissionBriefing(int level) {
return ret;
}
extern bool FirstGame;
bool Skip_next_movie = false;

// ---------------------------------------------------------------------------
// play movie
void DoMissionMovie(const char *movie) {
char temppath[_MAX_PATH];
if (PROGRAM(windowed)) {
mprintf(0, "Skipping movie...can't do in windowed mode!\n");
return;
}
// Don't play this movie the first time through. This is a horrible hack.
if (Skip_next_movie) {
Skip_next_movie = false;
return;
}

#ifdef D3_FAST
return;
#endif
Expand All @@ -1657,8 +1652,8 @@ void DoMissionMovie(const char *movie) {
ddio_MakePath(mpath, LocalD3Dir, "movies", movie, NULL);
PlayMovie(mpath);
}
// PlayMovie(movie);
}

///////////////////////////////////////////////////////////////////////////////
// Script Management for Missions and Levels
///////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 0 additions & 3 deletions Descent3/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,6 @@ void PreInitD3Systems() {
#endif
}

/*
Save game variables to the registry
*/
void SaveGameSettings() {
char tempbuffer[TEMPBUFFERSIZE];
int tempint;
Expand Down
5 changes: 5 additions & 0 deletions Descent3/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,9 @@ void RestartD3();

void InitMessage(const char *c, float progress = -1);

/**
* Save game variables to the registry
*/
void SaveGameSettings();

#endif
30 changes: 10 additions & 20 deletions Descent3/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,19 +658,21 @@
#include "menu.h"
#include "mmItem.h"
#include "game.h"
#include "gamesequence.h"
#include "Mission.h"
#include "multi_ui.h"
#include "ctlconfig.h"
#include "config.h"
#include "gamesave.h"
#include "gamesequence.h"
#include "demofile.h"
#include "pilot.h"
#include "LoadLevel.h"
#include "stringtable.h"
#include "mem.h"
#include "args.h"
#include "cinematics.h"
#include "multi_dll_mgr.h"
#include "newui_core.h"

#ifdef _WIN32
#define USE_DIRECTPLAY
Expand All @@ -681,9 +683,6 @@
#else
bool Directplay_lobby_launched_game = false;
#endif
#include "multi_dll_mgr.h"
#include "d3music.h"
#include "newui_core.h"

#define IDV_QUIT 0xff
// Menu Item Defines
Expand All @@ -702,8 +701,7 @@ bool MenuLoadLevel(void);
#endif
// for command line joining of games
bool Auto_connected = false;
// externed from init.cpp
extern void SaveGameSettings();

// runs command line options.
bool ProcessCommandLine();
// new game selection
Expand All @@ -715,7 +713,6 @@ extern bool Demo_looping;
bool FirstGame = false;

int MainMenu() {
extern void ShowStaticScreen(char *bitmap_filename, bool timed = false, float delay_time = 0.0f);
mmInterface main_menu;
bool exit_game = false;
bool exit_menu = false;
Expand Down Expand Up @@ -1127,15 +1124,16 @@ static inline int generate_mission_listbox(newuiListBox *lb, int n_maxfiles, cha
}
return c;
}
extern bool Skip_next_movie;

#define OEM_TRAINING_FILE "training.mn3"
#define OEM_MISSION_FILE "d3oem.mn3"

bool MenuNewGame() {
newuiTiledWindow menu;
newuiSheet *select_sheet;
newuiListBox *msn_lb;
char **filelist = NULL;
int n_missions, i, res; //,k
char **filelist = nullptr;
int n_missions, i, res;
bool found = false;
bool do_menu = true, load_mission = false, retval = true;
#ifdef DEMO
Expand All @@ -1150,18 +1148,10 @@ bool MenuNewGame() {
return false;
}
#else
#ifdef RELEASE
if ((!FindArg("-mission")) && (!FirstGame) && (-1 == Current_pilot.find_mission_data(TRAINING_MISSION_NAME))) {

FirstGame = true;

char moviepath[_MAX_PATH];
ddio_MakePath(moviepath, LocalD3Dir, "movies", "level1.mve", nullptr);
if (cfexist(moviepath)) {
PlayMovie(moviepath);
}
Skip_next_movie = true;

if (LoadMission("training.mn3")) {
CurrentPilotUpdateMissionStatus(true);
// go into game mode.
Expand Down Expand Up @@ -1190,7 +1180,7 @@ bool MenuNewGame() {
return false;
}
}
#endif

// create menu.
menu.Create(TXT_MENUNEWGAME, 0, 0, 448, 384);

Expand Down Expand Up @@ -1333,7 +1323,7 @@ bool MenuNewGame() {
goto redo_newgame_menu;
} else {
Current_mission.cur_level = start_level;
// pull out the ship permssions and use them
// pull out the ship permissions and use them
Players[0].ship_permissions = GetPilotShipPermissions(&Current_pilot, Current_mission.name);
}
}
Expand Down
7 changes: 5 additions & 2 deletions Descent3/mmItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@
*/
#ifndef MMITEM_H
#define MMITEM_H

#include "cinematics.h"
#include "gamefont.h"
#include "newui.h"
#include "psclass.h"
#include "gamefont.h"

#if ((!defined(OEM)) && (!defined(DEMO)))
#define MOVIE_MENU
#endif
Expand Down Expand Up @@ -176,7 +179,7 @@ class mmItem : public UIGadget {
virtual void OnSelect();
};
// Main Menu Interface Object
struct tCinematic;

class mmInterface : public UIWindow {
int m_nmenu_items; // number of menu items available.
mmItem m_menuitems[N_MMENU_ITEMS]; // main menu items
Expand Down
9 changes: 5 additions & 4 deletions ddebug/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,11 @@ void ddio_InternalKeyClose();
#else
#define debug_break()
#endif

#if defined(WIN32)
// We forward declare PEXCEPTION_POINTERS so that the function
// prototype doesn't needlessly require windows.h.
typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
long __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data);

#include <windows.h>

long WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data);
#endif
#endif
3 changes: 1 addition & 2 deletions ddebug/windebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ void dump_text_to_clipboard(char *text) { DumpTextToClipboard(text); }
///////////////////////////////////////////////////////////////////////////////

#pragma comment(lib, "DbgHelp.lib")

long __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data) {
long WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data) {
static bool BeenHere = false;
if (BeenHere) // Going recursive! That must mean this routine crashed!
return EXCEPTION_CONTINUE_SEARCH;
Expand Down

0 comments on commit bda97fc

Please sign in to comment.