Skip to content

Commit

Permalink
Merge pull request #802 from WALLOFJUSTICE/dev-23-q1
Browse files Browse the repository at this point in the history
* holiday theme fixes, lang entry clean up
  • Loading branch information
SheridanR authored Oct 9, 2023
2 parents a514fe4 + c531014 commit eb118ac
Show file tree
Hide file tree
Showing 20 changed files with 1,303 additions and 5,163 deletions.
3,570 changes: 970 additions & 2,600 deletions lang/en.txt

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17847,33 +17847,6 @@ char const * playerClassLangEntry(int classnum, int playernum)

/*-------------------------------------------------------------------------------

playerClassDescription
get text string for the description of player chosen classes.

-------------------------------------------------------------------------------*/

char const * playerClassDescription(int classnum, int playernum)
{
if ( classnum >= CLASS_BARBARIAN && classnum <= CLASS_JOKER )
{
return Language::get(10 + classnum);
}
else if ( classnum >= CLASS_CONJURER )
{
return Language::get(3231 + classnum - CLASS_CONJURER);
}
else if ( classnum >= CLASS_SEXTON && classnum <= CLASS_MONK )
{
return Language::get(2560 + classnum - CLASS_SEXTON);
}
else
{
return "undefined description";
}
}

/*-------------------------------------------------------------------------------

setHelmetLimbOffset
Adjusts helmet offsets for all monsters, depending on the type of headwear.

Expand Down
1 change: 0 additions & 1 deletion src/entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,6 @@ static const int MSG_TOOL_BOMB = 6;
static const int MSG_COMBAT_BASIC = 7;
void messagePlayerMonsterEvent(int player, Uint32 color, Stat& monsterStats, const char* msgGeneric, const char* msgNamed, int detailType, Entity* optionalEntity = nullptr);
char const * playerClassLangEntry(int classnum, int playernum);
char const * playerClassDescription(int classnum, int playernum);

//Some testing functions/commands.
Entity* summonChest(long x, long y);
Expand Down
6 changes: 6 additions & 0 deletions src/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3257,6 +3257,12 @@ void generatePolyModels(int start, int end, bool forceCacheRebuild)
quads.first = NULL;
quads.last = NULL;

if ( !polymodels )
{
polymodels = (polymodel_t*)malloc(sizeof(polymodel_t) * nummodels);
memset(polymodels, 0, sizeof(polymodel_t) * nummodels);
}

for ( c = start; c < end; ++c )
{
updateLoadingScreen(30 + ((real_t)(c - start) / (end - start)) * 30.0);
Expand Down
11 changes: 0 additions & 11 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6569,17 +6569,6 @@ int main(int argc, char** argv)
skipintro = false;
}

// load default language file (english)
if ( Language::loadLanguage("en", true) )
{
printlog("Fatal error: failed to load default language file!\n");
if (logfile)
{
fclose(logfile);
}
exit(1);
}

// initialize map
map.tiles = nullptr;
map.entities = (list_t*) malloc(sizeof(list_t));
Expand Down
22 changes: 18 additions & 4 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ int initApp(char const * const title, int fullscreen)
return 13;
}

// load default language file (english)
Language::languageCode = "en";
if ( Language::reloadLanguage() )
{
printlog("Fatal error: failed to load default language file!\n");
if ( logfile )
{
fclose(logfile);
}
exit(1);
}

// initialize SDL
window_title = title;
printlog("initializing SDL...\n");
Expand Down Expand Up @@ -904,8 +916,8 @@ int Language::loadLanguage(char const * const lang, bool forceLoadBaseDirectory)
TTF_SetFontHinting(ttf16, TTF_HINTING_MONO);

// open language file
File* fp;
if ( (fp = openDataFile(langFilepath.c_str(), "rb")) == NULL )
File* fp = FileIO::open(langFilepath.c_str(), "rb");
if ( !fp )
{
printlog("error: unable to load language file: '%s'", langFilepath.c_str());
return 1;
Expand All @@ -915,7 +927,10 @@ int Language::loadLanguage(char const * const lang, bool forceLoadBaseDirectory)
languageCode = lang;

tmpEntries.clear();
entries.clear();
if ( forceLoadBaseDirectory )
{
entries.clear();
}

// read file
Uint32 line;
Expand Down Expand Up @@ -992,7 +1007,6 @@ int Language::loadLanguage(char const * const lang, bool forceLoadBaseDirectory)
FileIO::close(fp);
printlog( "successfully loaded language file '%s'\n", langFilepath.c_str());

initMenuOptions();
return 0;
}

Expand Down
Loading

0 comments on commit eb118ac

Please sign in to comment.