Skip to content

Commit

Permalink
Adds VINIFERA.VQA playback to startup movies.
Browse files Browse the repository at this point in the history
  • Loading branch information
CCHyper committed Jul 23, 2022
1 parent 96a93d6 commit d0e074a
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 39 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ jobs:
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
ls -p | grep -v /
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.exe
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -180,15 +182,17 @@ jobs:
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
ls -p | grep -v /
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.dat
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: vinifera-nightly-${{ steps.vars.outputs.sha_short }}-ts_client
path: artifact
path: artifact
4 changes: 4 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ jobs:
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.exe
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.VQA ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -108,11 +110,13 @@ jobs:
shell: bash
run: |
mkdir artifact
mkdir artifact/Movies
cp ./build/Vinifera.dll ./artifact/Vinifera.dll
cp ./build/Vinifera.pdb ./artifact/Vinifera.pdb
cp ./build/LaunchVinifera.exe ./artifact/LaunchVinifera.dat
cp ./build/_deps/tspp-src/pdb/Game.pdb ./artifact/Game.pdb
cp ./build/_deps/tspp-src/edb/Game.edb ./artifact/Game.edb
cp ./vinifera-files/files/VINIFERA.WMV ./artifact/Movies/VINIFERA.VQA
- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down
55 changes: 43 additions & 12 deletions src/extensions/init/initext_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,47 +146,78 @@ static bool CCFile_Is_Available(const char *filename)
return CCFileClass(filename).Is_Available();
}

static bool CCFile_Validate_Is_Available(const char *filename, int size)
{
return CCFileClass(filename).Is_Available() && CCFileClass(filename).Size() == size;
}


/**
* #issue-478
*
*
* Adds command line options to skip startup movies.
*
* @author: CCHyper
*/
DECLARE_PATCH(_Init_Game_Skip_Startup_Movies_Patch)
static bool Vinifera_Play_Startup_Movies()
{
if (Vinifera_SkipStartupMovies) {
DEBUG_INFO("Skipping startup movies.\n");
goto skip_loading_screen;
}
static const int VINIFERA_VQA_SIZE = 704889;
static const int WWLOGO_VQA_SIZE = 2415362;

if (Special.IsFromInstall) {
DEBUG_GAME("Playing first time intro sequence.\n");
Play_Movie("EVA.VQA", THEME_NONE, true, true, true);
DEBUG_INFO("Playing first time intro sequence.\n");
Play_Movie("EVA.VQA");
}

if (!Vinifera_SkipWWLogoMovie) {
DEBUG_GAME("Playing startup movies.\n");
Play_Movie("WWLOGO.VQA", THEME_NONE, true, true, true);
if (!Vinifera_SkipLogoMovies) {
DEBUG_INFO("Playing logo movies.\n");
if (!CCFile_Validate_Is_Available("VINIFERA.VQA", VINIFERA_VQA_SIZE)) {
DEBUG_ERROR("Failed to find VINIFERA.VQA!\n");
return false;
}
Play_Movie("VINIFERA.VQA");
if (!CCFile_Validate_Is_Available("WWLOGO.VQA", WWLOGO_VQA_SIZE)) {
DEBUG_ERROR("Failed to find WWLOGO.VQA!\n");
return false;
}
Play_Movie("WWLOGO.VQA");
} else {
DEBUG_INFO("Skipping startup movie.\n");
DEBUG_INFO("Skipping logo movies.\n");
}

if (!NewMenuClass::Get()) {
DEBUG_INFO("Playing title movie.\n");
if (CCFile_Is_Available("FS_TITLE.VQA")) {
Play_Movie("FS_TITLE.VQA", THEME_NONE, true, false, true);
} else {
Play_Movie("STARTUP.VQA", THEME_NONE, true, false, true);
}
}

return true;
}

DECLARE_PATCH(_Init_Game_Skip_Startup_Movies_Patch)
{
if (Vinifera_SkipStartupMovies) {
DEBUG_INFO("Skipping startup movies.\n");
goto skip_loading_screen;
}

if (!Vinifera_Play_Startup_Movies()) {
goto failed;
}

loading_screen:
_asm { or ebx, 0xFFFFFFFF }
JMP(0x004E0848);

skip_loading_screen:
JMP(0x004E084D);

failed:
_asm { mov ebx, 1 }
JMP(0x004E08B3);
}


Expand Down
63 changes: 39 additions & 24 deletions src/vinifera/vinifera_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,18 @@ bool Vinifera_Parse_Command_Line(int argc, char *argv[])
*/
bool Vinifera_Startup()
{
DWORD rc;
DynamicVectorClass<Wstring> search_paths;

#ifndef NDEBUG
/**
* Debug paths for CD contents (folders must contain .DSK files of the same name).
*/
search_paths.Add("TS1");
search_paths.Add("TS2");
search_paths.Add("TS3");
#endif

/**
* #issue-514:
*
Expand All @@ -417,9 +429,6 @@ bool Vinifera_Startup()
* @author: CCHyper
*/
#if defined(TS_CLIENT)
DWORD rc;
DynamicVectorClass<Wstring> search_paths;

/**
* If -CD has been defined, set the root directory as highest priority.
*/
Expand All @@ -432,12 +441,17 @@ bool Vinifera_Startup()
*/
search_paths.Add("INI");
search_paths.Add("MIX");
#endif

search_paths.Add("MOVIES");

#if defined(TS_CLIENT)
search_paths.Add("MUSIC");
search_paths.Add("SOUNDS");
search_paths.Add("MAPS");
search_paths.Add("MAPS\\MULTIPLAYER");
search_paths.Add("MAPS\\MISSION");
#endif

/**
* Current path (perhaps set set with -CD) should go next.
Expand All @@ -446,32 +460,33 @@ bool Vinifera_Startup()
search_paths.Add(CCFileClass::RawPath);
}

char *new_path = new char [_MAX_PATH * search_paths.Count()+1];
new_path[0] = '\0';
if (search_paths.Count() > 0) {
char *new_path = new char [_MAX_PATH * search_paths.Count()+1];
new_path[0] = '\0';

/**
* Build the search path string.
*/
for (int i = 0; i < search_paths.Count(); ++i) {
if (i != 0) std::strcat(new_path, ";");
std::strcat(new_path, search_paths[i].Peek_Buffer());
}
/**
* Build the search path string.
*/
for (int i = 0; i < search_paths.Count(); ++i) {
if (i != 0) std::strcat(new_path, ";");
std::strcat(new_path, search_paths[i].Peek_Buffer());
}

/**
* Clear the current path ready to be set.
*/
CCFileClass::Clear_Search_Drives();
CCFileClass::Reset_Raw_Path();
/**
* Clear the current path ready to be set.
*/
CCFileClass::Clear_Search_Drives();
CCFileClass::Reset_Raw_Path();

/**
* Set the new search drive path.
*/
CCFileClass::Set_Search_Drives(new_path);
/**
* Set the new search drive path.
*/
CCFileClass::Set_Search_Drives(new_path);

delete [] new_path;
delete [] new_path;

DEBUG_INFO("SearchPath: %s\n", CCFileClass::RawPath);
#endif
DEBUG_INFO("SearchPath: %s\n", CCFileClass::RawPath);
}

/**
* Load Vinifera settings and overrides.
Expand Down
2 changes: 1 addition & 1 deletion src/vinifera/vinifera_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool Vinifera_Developer_FrameStep = false;
int Vinifera_Developer_FrameStepCount = 0;
bool Vinifera_Developer_AIControl = false;

bool Vinifera_SkipWWLogoMovie = false;
bool Vinifera_SkipLogoMovies = false;
bool Vinifera_SkipStartupMovies = false;

bool Vinifera_ShowSuperWeaponTimers = true;
Expand Down
2 changes: 1 addition & 1 deletion src/vinifera/vinifera_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extern bool Vinifera_Developer_AIControl;
/**
* Various globals.
*/
extern bool Vinifera_SkipWWLogoMovie;
extern bool Vinifera_SkipLogoMovies;
extern bool Vinifera_SkipStartupMovies;

extern bool Vinifera_ShowSuperWeaponTimers;
Expand Down

0 comments on commit d0e074a

Please sign in to comment.