Skip to content

Commit

Permalink
Merge branch 'barony-next' of github.com:TurningWheel/Barony into bar…
Browse files Browse the repository at this point in the history
…ony-next
  • Loading branch information
addictgamer committed Mar 11, 2018
2 parents a2b0f0e + f16201d commit 27b210d
Show file tree
Hide file tree
Showing 22 changed files with 419 additions and 127 deletions.
5 changes: 5 additions & 0 deletions src/actladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ void actPortal(Entity* my)
}
break;
}
if ( !strncmp(map.name, "Cockatrice Lair", 15)
|| !strncmp(map.name, "Bram's Castle", 13) )
{
skipLevelsOnLoad = -1; // don't skip a regular level.
}
}
if ( !my->portalNotSecret )
{
Expand Down
2 changes: 1 addition & 1 deletion src/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ void buttonAttributes(button_t* my)
snprintf(skyboxtext, 4, "%d", map.skybox);
for ( int z = 0; z < MAPFLAGS; ++z )
{
if ( z < MAP_FLAG_GENBYTES1 && z > MAP_FLAG_GENBYTES6 )
if ( z < MAP_FLAG_GENBYTES1 || z > MAP_FLAG_GENBYTES6 )
{
snprintf(mapflagtext[z], 4, "%d", map.flags[z]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2730,7 +2730,7 @@ void Entity::handleEffects(Stat* myStats)

if (myStats->EFFECTS[EFF_VAMPIRICAURA])
{
spawnAmbientParticles(30, 600, 20 + rand() % 30, 0.5, true);
spawnAmbientParticles(40, 600, 20 + rand() % 30, 0.5, true);
}

if ( myStats->EFFECTS[EFF_INVISIBLE] && myStats->type == SHADOW )
Expand Down
4 changes: 2 additions & 2 deletions src/entity_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ char spriteEditorNameStrings[NUM_EDITOR_SPRITES][64] =
"INSECTOID",
"GOATMAN",
"AUTOMATON",
"UNKNOWN1",
"UNKNOWN2",
"LICH ICE",
"LICH FIRE",
"NOT USED",
"SUMMON TRAP",
"CRYSTAL SHARD (West Wall)",
Expand Down
1 change: 1 addition & 0 deletions src/files.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ bool dataPathExists(const char *const);
bool completePath(char *dest, const char * const path);
std::vector<std::string> getLinesFromDataFile(std::string filename);
extern char datadir[PATH_MAX]; //PATH_MAX as defined in main.hpp -- maybe define in Config.hpp?
int loadMainMenuMap(bool blessedAdditionMaps, bool forceVictoryMap);
92 changes: 44 additions & 48 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ void gameLogic(void)
}
else
{
if ( skipLevelsOnLoad < 0 )
{
currentlevel += skipLevelsOnLoad;
}
++currentlevel;
}
skipLevelsOnLoad = 0;
Expand Down Expand Up @@ -2399,35 +2403,18 @@ int main(int argc, char** argv)
fadeout = false;
fadefinished = false;
#else
switch ( rand() % 4 )
int menuMapType = 0;
switch ( rand() % 4 ) // STEAM VERSION INTRO
{
case 0:
loadMap("mainmenu1", &map, map.entities, map.creatures);
camera.x = 8;
camera.y = 4.5;
camera.z = 0;
camera.ang = 0.6;
break;
case 1:
loadMap("mainmenu2", &map, map.entities, map.creatures);
camera.x = 7;
camera.y = 4;
camera.z = -4;
camera.ang = 1.0;
break;
case 2:
loadMap("mainmenu3", &map, map.entities, map.creatures);
camera.x = 5;
camera.y = 3;
camera.z = 0;
camera.ang = 1.0;
menuMapType = loadMainMenuMap(true, false);
break;
case 3:
loadMap("mainmenu4", &map, map.entities, map.creatures);
camera.x = 6;
camera.y = 14.5;
camera.z = -24;
camera.ang = 5.0;
menuMapType = loadMainMenuMap(false, false);
break;
default:
break;
}
numplayers = 0;
Expand All @@ -2449,7 +2436,14 @@ int main(int argc, char** argv)
fadeout = false;
fadefinished = false;
#if defined(HAVE_FMOD) || defined(HAVE_OPENAL)
playmusic(intromusic, true, false, false);
if ( menuMapType == 1 )
{
playmusic(intromusic[2], true, false, false);
}
else
{
playmusic(intromusic[1], true, false, false);
}
#endif
}
#endif
Expand Down Expand Up @@ -2479,38 +2473,21 @@ int main(int argc, char** argv)
old_sdl_ticks = SDL_GetTicks();
indev_timer += time_passed;

int menuMapType = 0;
//if( (*inputPressed(joyimpulses[INJOY_MENU_NEXT]) || *inputPressed(joyimpulses[INJOY_MENU_CANCEL]) || *inputPressed(joyimpulses[INJOY_BACK]) || keystatus[SDL_SCANCODE_ESCAPE] || keystatus[SDL_SCANCODE_SPACE] || keystatus[SDL_SCANCODE_RETURN] || mousestatus[SDL_BUTTON_LEFT] || indev_timer >= indev_displaytime) && !fadeout) {
if ( (*inputPressed(joyimpulses[INJOY_MENU_NEXT]) || *inputPressed(joyimpulses[INJOY_MENU_CANCEL]) || keystatus[SDL_SCANCODE_ESCAPE] || keystatus[SDL_SCANCODE_SPACE] || keystatus[SDL_SCANCODE_RETURN] || mousestatus[SDL_BUTTON_LEFT] || indev_timer >= indev_displaytime) && !fadeout)
{
switch ( rand() % 4 )
switch ( rand() % 4 ) // DRM FREE VERSION INTRO
{
case 0:
loadMap("mainmenu1", &map, map.entities, map.creatures);
camera.x = 8;
camera.y = 4.5;
camera.z = 0;
camera.ang = 0.6;
break;
case 1:
loadMap("mainmenu2", &map, map.entities, map.creatures);
camera.x = 7;
camera.y = 4;
camera.z = -4;
camera.ang = 1.0;
break;
case 2:
loadMap("mainmenu3", &map, map.entities, map.creatures);
camera.x = 5;
camera.y = 3;
camera.z = 0;
camera.ang = 1.0;
menuMapType = loadMainMenuMap(true, false);
break;
case 3:
loadMap("mainmenu4", &map, map.entities, map.creatures);
camera.x = 6;
camera.y = 14.5;
camera.z = -24;
camera.ang = 5.0;
menuMapType = loadMainMenuMap(false, false);
break;
default:
break;
}
numplayers = 0;
Expand All @@ -2535,7 +2512,14 @@ int main(int argc, char** argv)
fadeout = false;
fadefinished = false;
#ifdef MUSIC
playmusic(intromusic, true, false, false);
if ( menuMapType == 1 )
{
playmusic(intromusic[2], true, false, false);
}
else
{
playmusic(intromusic[1], true, false, false);
}
#endif
}
}
Expand Down Expand Up @@ -3098,6 +3082,18 @@ int main(int argc, char** argv)
{
SDL_SetRelativeMouseMode(SDL_TRUE);
}

if ( lock_right_sidebar )
{
if ( proficienciesPage == 1 )
{
drawPartySheet();
}
else
{
drawSkillsSheet();
}
}
}

// Draw the static HUD elements
Expand Down
28 changes: 26 additions & 2 deletions src/init_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ int fmod_result;
#endif

FMOD_ChannelGroup_SetVolume(music_group, musvolume / 128.f);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/intro.ogg", FMOD_SOFTWARE, NULL, &intromusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/introduction.ogg", FMOD_SOFTWARE, NULL, &introductionmusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/intermission.ogg", FMOD_SOFTWARE, NULL, &intermissionmusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/minetown.ogg", FMOD_SOFTWARE, NULL, &minetownmusic);
Expand All @@ -402,6 +401,7 @@ int fmod_result;
fmod_result = FMOD_System_CreateStream(fmod_system, "music/endgame.ogg", FMOD_SOFTWARE, NULL, &endgamemusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/escape.ogg", FMOD_SOFTWARE, NULL, &escapemusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/devil.ogg", FMOD_SOFTWARE, NULL, &devilmusic);
fmod_result = FMOD_System_CreateStream(fmod_system, "music/sanctum.ogg", FMOD_SOFTWARE, NULL, &sanctummusic);
//fmod_result = FMOD_System_CreateStream(fmod_system, "music/story.ogg", FMOD_SOFTWARE, NULL, &storymusic);

if ( NUMMINESMUSIC > 0 )
Expand Down Expand Up @@ -485,6 +485,22 @@ int fmod_result;
fmod_result = FMOD_System_CreateStream(fmod_system, tempstr, FMOD_SOFTWARE, NULL, &citadelmusic[c]);
}
}
if ( NUMINTROMUSIC > 0 )
{
intromusic = (FMOD_SOUND**)malloc(sizeof(FMOD_SOUND*)*NUMINTROMUSIC);
for ( c = 0; c < NUMINTROMUSIC; c++ )
{
if ( c == 0 )
{
strcpy(tempstr, "music/intro.ogg");
}
else
{
snprintf(tempstr, 1000, "music/intro%02d.ogg", c);
}
fmod_result = FMOD_System_CreateStream(fmod_system, tempstr, FMOD_SOFTWARE, NULL, &intromusic[c]);
}
}
#ifdef HAVE_OPENAL
#undef FMOD_ChannelGroup_SetVolume
#undef fmod_system
Expand Down Expand Up @@ -693,7 +709,6 @@ void deinitGame()
#endif
FMOD_Channel_Stop(music_channel);
FMOD_Channel_Stop(music_channel2);
FMOD_Sound_Release(intromusic);
FMOD_Sound_Release(introductionmusic);
FMOD_Sound_Release(intermissionmusic);
FMOD_Sound_Release(minetownmusic);
Expand All @@ -705,6 +720,7 @@ void deinitGame()
FMOD_Sound_Release(endgamemusic);
FMOD_Sound_Release(escapemusic);
FMOD_Sound_Release(devilmusic);
FMOD_Sound_Release(sanctummusic);
for ( c = 0; c < NUMMINESMUSIC; c++ )
{
FMOD_Sound_Release(minesmusic[c]);
Expand Down Expand Up @@ -777,6 +793,14 @@ void deinitGame()
{
free(citadelmusic);
}
for ( c = 0; c < NUMINTROMUSIC; c++ )
{
FMOD_Sound_Release(intromusic[c]);
}
if ( intromusic )
{
free(intromusic);
}
#ifdef HAVE_OPENAL
#undef FMOD_Channel_Stop
#undef FMOD_Sound_Release
Expand Down
15 changes: 14 additions & 1 deletion src/interface/consolecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,11 @@ void consoleCommand(char* command_str)
//messagePlayer(clientnum, language[299]);
}
}
else if ( !strncmp(command_str, "/jumplevel ", 11) )
{
skipLevelsOnLoad = atoi((char*)(command_str + 11));
consoleCommand("/nextlevel");
}
else if ( !strncmp(command_str, "/maxout3", 8) )
{
if ( !(svFlags & SV_FLAG_CHEATS) )
Expand All @@ -878,7 +883,7 @@ void consoleCommand(char* command_str)
{
int c;
Stat* myStats = stats[0];
skipLevelsOnLoad = 26;
skipLevelsOnLoad = 31;
for ( c = 0; c < 24; c++ )
{
consoleCommand("/levelup");
Expand Down Expand Up @@ -1418,6 +1423,14 @@ void consoleCommand(char* command_str)
{
hotbar_numkey_quick_add = !hotbar_numkey_quick_add;
}
else if ( !strncmp(command_str, "/locksidebar", 12) )
{
lock_right_sidebar = (lock_right_sidebar == false);
if ( lock_right_sidebar )
{
proficienciesPage = 1;
}
}
else if (!strncmp(command_str, "/lang ", 6))
{
command_str[8] = 0;
Expand Down
18 changes: 17 additions & 1 deletion src/interface/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ SDL_Surface *con_bmp64 = NULL;
SDL_Surface *int_bmp64 = NULL;
SDL_Surface *per_bmp64 = NULL;
SDL_Surface *chr_bmp64 = NULL;
SDL_Surface *sidebar_lock_bmp = nullptr;
SDL_Surface *sidebar_unlock_bmp = nullptr;
int spellscroll = 0;
int magicspell_list_offset_x = 0;
int magicspell_list_offset_y = 0;
Expand Down Expand Up @@ -142,7 +144,7 @@ bool hotbar_numkey_quick_add = false;
bool disable_messages = false;
bool right_click_protect = false;
bool auto_appraise_new_items = false;

bool lock_right_sidebar = false;

bool loadInterfaceResources()
{
Expand Down Expand Up @@ -244,6 +246,8 @@ bool loadInterfaceResources()
per_bmp64 = loadImage("images/system/per64.png");
chr_bmp64 = loadImage("images/system/chr64.png");

sidebar_lock_bmp = loadImage("images/system/locksidebar.png");
sidebar_unlock_bmp = loadImage("images/system/unlocksidebar.png");
hotbar_img = loadImage("images/system/hotbar_slot.png");
hotbar_spell_img = loadImage("images/system/magic/hotbar_spell.png");
int i = 0;
Expand Down Expand Up @@ -489,6 +493,14 @@ void freeInterfaceResources()
{
SDL_FreeSurface(chr_bmp64);
}
if ( sidebar_lock_bmp )
{
SDL_FreeSurface(sidebar_lock_bmp);
}
if ( sidebar_unlock_bmp )
{
SDL_FreeSurface(sidebar_unlock_bmp);
}
list_FreeAll(&damageIndicators);
}

Expand Down Expand Up @@ -911,6 +923,10 @@ int saveConfig(char* filename)
{
fprintf(fp, "/quickaddtohotbar\n");
}
if ( lock_right_sidebar )
{
fprintf(fp, "/locksidebar\n");
}
if (disable_messages)
{
fprintf(fp, "/disablemessages\n");
Expand Down
7 changes: 7 additions & 0 deletions src/interface/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ void warpMouseToSelectedRemoveCurseSlot();
bool mouseInBounds(int x1, int x2, int y1, int y2);

void updateCharacterSheet();
void drawPartySheet();
void drawSkillsSheet();

//Right sidebar defines.
#define RIGHTSIDEBAR_X (xres - rightsidebar_titlebar_img->w)
Expand Down Expand Up @@ -362,6 +364,8 @@ extern bool right_click_protect;

extern bool auto_appraise_new_items;

extern bool lock_right_sidebar;

const char* getInputName(Uint32 scancode);
Sint8* inputPressed(Uint32 scancode);

Expand All @@ -388,6 +392,9 @@ extern SDL_Surface *int_bmp64;
extern SDL_Surface *per_bmp64;
extern SDL_Surface *chr_bmp64;

extern SDL_Surface *sidebar_lock_bmp;
extern SDL_Surface *sidebar_unlock_bmp;

void printStatBonus(TTF_Font* outputFont, Sint32 stat, Sint32 statWithModifiers, int x, int y);
void attackHoverText(Sint32 input[6]);
Sint32 displayAttackPower(Sint32 output[6]);
Expand Down
Loading

0 comments on commit 27b210d

Please sign in to comment.