List of commits:
Subject Hash Author Date (UTC)
Initial modding support with -m parameters 94429b99dd3c85d67d8a9fe8b2faee06c1e9fcde mse 2021-05-29 22:01:40
Moddable dialogue loading via FileOpen 6183fb4b8dde53f07f8e7bf6835a8fe7ca0a8a8c mse 2021-05-29 10:54:24
Moddable sound file loading via FileOpen ed4d1680cfb17f573fe799908d35e6856c183076 mse 2021-05-29 07:21:32
Update en_to_zh, start implementing moddable FileOpen, fix -Wsign-compare 89d00440e1c35d46851fb1d300107da9725d261d mse 2021-05-27 21:29:27
Add a third procedural basket and winnerberry translation string 9b970d581d5094fd3ea7b9da2b4e397c4f4c94db mse 2021-05-27 09:29:02
Add STOPSOUNDS command 22507196106fcd8db7b4bae15b6a2bf9168dd61e mse 2021-05-27 05:56:57
Wake player when hit b2bc7d9cb37a9c9a707e9b8428e6f4d3fa2f27b7 mse 2021-05-26 08:50:53
Minor clarifications d5a83695acdf78b21610239d530b1317dc4003cc mse 2021-05-24 00:11:59
DRM-free dynamic target c51ae66a80c38d4d8aec606ad04492ea12a56fcd mse 2021-05-23 23:53:32
Initial commit bfb7298e48367d2ac0924811b4950f3066ff075c mse 2021-05-22 05:08:16
Commit 94429b99dd3c85d67d8a9fe8b2faee06c1e9fcde - Initial modding support with -m parameters
Author: mse
Author date (UTC): 2021-05-29 22:01
Committer name: mse
Committer date (UTC): 2021-05-29 22:01
Parent(s): 6183fb4b8dde53f07f8e7bf6835a8fe7ca0a8a8c
Signing key:
Tree: 812fa3c897a36a0b1da26852585b83d55b57e254
File Lines added Lines deleted
confec.cpp 22 5
include/fworld.h 7 2
File confec.cpp changed (mode: 100644) (index 147c648..2ea12a9)
... ... std::string language = "en";
457 457 // Whitelist these languages. Generally, every game should support these. // Whitelist these languages. Generally, every game should support these.
458 458 std::vector<std::string> language_whitelist = { "en", "zh" }; std::vector<std::string> language_whitelist = { "en", "zh" };
459 459
460 // Use these mods.
461 std::vector<std::string> mod_paths = {};
462
460 463 bool recipes_display = false, trading_display = false, bool recipes_display = false, trading_display = false,
461 464 sequencer_display = false, cake_display = false, sequencer_display = false, cake_display = false,
462 465 settings_display = false, character_select_display = false; settings_display = false, character_select_display = false;
 
... ... int main( int argc, char* argv[] ){
917 920
918 921 for( int i = 1; i < argc; i++ ){ for( int i = 1; i < argc; i++ ){
919 922 std::string arg( argv[i] ); std::string arg( argv[i] );
920 if( arg.length() >= 2 && arg.substr( 0, 2 ) == "--" ){
921 if( arg == "--window" ){
923 if( arg.length() >= 2 && arg[0] == '-' ){
924 if( arg.length() >= 3 && arg.substr( 0, 2 ) == "-m" ){
925 // Push the mod path to the front of the vector.
926 // This gives it a higher priority than other mod paths,
927 // such that later -m parameters override earlier -m
928 // parameters.
929 mod_paths.insert( mod_paths.begin(), arg.substr( 2 ) );
930 printf( "Using mod: %s\n", mod_paths[0].c_str() );
931 }else if( arg == "--window" ){
922 932 windowed_mode = true; windowed_mode = true;
923 933 printf( "Starting in windowed mode.\n" ); printf( "Starting in windowed mode.\n" );
924 934 }else{ }else{
925 935 fprintf( fprintf(
926 936 stderr, stderr,
927 937 "Unrecognized argument. Valid arguments are:\n%s\n", "Unrecognized argument. Valid arguments are:\n%s\n",
928 "--window"
938 "-mModPath --window"
929 939 ); );
930 940 } }
931 941 }else{ }else{
 
... ... int main( int argc, char* argv[] ){
1355 1365 FILE *FileOpen( const char* filename, const char* modes ){ FILE *FileOpen( const char* filename, const char* modes ){
1356 1366 // Check if filename starts with the base data path. // Check if filename starts with the base data path.
1357 1367 std::string str_file = filename, str_data = data_path + "/"; std::string str_file = filename, str_data = data_path + "/";
1358 if( str_file.length() >= str_data.length()
1368 if( str_file.length() > str_data.length()
1359 1369 && str_file.substr( 0, str_data.length() ) == str_data ){ && str_file.substr( 0, str_data.length() ) == str_data ){
1360 // TODO: String replacement and iterate through mod paths.
1370 // Iterate through mod paths.
1371 std::string suffix = str_file.substr( str_data.length() );
1372 for( std::string &path : mod_paths ){
1373 // Return the pointer to the first matching file.
1374 str_file = path + "/" + suffix;
1375 FILE *result = fopen( str_file.c_str(), modes );
1376 if( result ) return result;
1377 }
1361 1378 } }
1362 1379 // Fall back to open the path specified. // Fall back to open the path specified.
1363 1380 return fopen( filename, modes ); return fopen( filename, modes );
File include/fworld.h changed (mode: 100755) (index ede7752..37206c5)
... ... fgl::Texture World::getTexture( std::string basePath, std::string imageName, boo
630 630 #ifdef STBI_INCLUDE_STB_IMAGE_H #ifdef STBI_INCLUDE_STB_IMAGE_H
631 631 // Load the image from the base path but only record the image's canonical name. // Load the image from the base path but only record the image's canonical name.
632 632 std::string fileName = basePath + "/" + imageName; std::string fileName = basePath + "/" + imageName;
633 int imgWidth, imgHeight, imgChannels;
634 unsigned char *imgData = stbi_load( fileName.c_str(), &imgWidth, &imgHeight, &imgChannels, 0 );
633 int imgWidth = 0, imgHeight = 0, imgChannels = 0;
634 unsigned char *imgData = nullptr;
635 FILE *file = FileOpen( fileName.c_str(), "rb" );
636 if( file ){
637 imgData = stbi_load_from_file( file, &imgWidth, &imgHeight, &imgChannels, 0 );
638 fclose( file );
639 }
635 640 fgl::Texture imgTexture = fgl::loadTexture( imgData, imgWidth, imgHeight, imgChannels, false, filter ); fgl::Texture imgTexture = fgl::loadTexture( imgData, imgWidth, imgHeight, imgChannels, false, filter );
636 641 stbi_image_free( imgData ); stbi_image_free( imgData );
637 642 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/ConfectionerEngine

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main