Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barony next user data #86

Closed
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cde87d6
Move inline item functions to header
lheckemann Sep 24, 2017
3d0e21d
Move files.cpp's prototypes into their own header
lheckemann Sep 24, 2017
f1fd44e
Move init.cpp's prototypes into their own header
lheckemann Jun 5, 2017
a5c57e8
Move list.cpp's prototypes into their own header
lheckemann Jun 5, 2017
cc2ffac
Move light.cpp's prototypes into their own header
lheckemann Jun 5, 2017
8ac2b73
Move draw prototypes to their own header
lheckemann Jun 5, 2017
ec9a0ef
completePath → completeDataPath
lheckemann Jun 5, 2017
f4f277a
Remove completeDataPath from public API of files
lheckemann Jun 5, 2017
d3044e8
Reuse single RWops for font loading
lheckemann Jun 5, 2017
411d95f
Move getLinesFromFile
lheckemann Jun 5, 2017
87ddb91
Move all direct user directory access to files.cpp
lheckemann Jun 13, 2017
6be5878
Fix data file reference in editor
lheckemann Jun 18, 2017
5685bbb
Use C++ vector of strings for map names in editor
lheckemann Jun 18, 2017
806eafa
Truly abstract over sound system
lheckemann Jun 18, 2017
f7d96cd
Reduce duplication in CMakeLists flag setting
lheckemann Sep 24, 2017
06a26af
Fix all uses of string literals as char*
lheckemann Sep 24, 2017
4d4062e
Add preambles to new header files
lheckemann Sep 25, 2017
4790f53
Fix typo in CMakeLists.txt
lheckemann Sep 27, 2017
5189d58
Fix default datadir
lheckemann Oct 9, 2017
b9de9b3
files.cpp: move all braces to their own lines
lheckemann Oct 9, 2017
f4c7f02
More style fixes
lheckemann Oct 9, 2017
62ae965
Fix preambles for sound implementations
lheckemann Oct 9, 2017
8afdeca
Fix user data dir creation for macOS
lheckemann Oct 9, 2017
5b2f8bc
Fix FMOD
lheckemann Oct 9, 2017
d1ca4dc
* Fixed some Windows compilation issues.
addictgamer Oct 12, 2017
791dcdc
Use portable C++ getline rather than POSIX getline
lheckemann Oct 13, 2017
252ddc2
Fix getLinesFromDataFile
lheckemann Oct 13, 2017
d400272
Hopefully fix macOS crash on exit
lheckemann Oct 13, 2017
ce035eb
* Further Windows compilation fixes: Windows wants _mkdir() over mkd…
addictgamer Oct 14, 2017
c9d8248
Fix FMOD file callbacks on windows (?)
lheckemann Oct 16, 2017
df41f27
Remove obsolete sound.cpp
lheckemann Oct 18, 2017
c1bea0e
Remove unused SoundSystem type
lheckemann Oct 18, 2017
a0b96f7
Revert "Fix FMOD file callbacks on windows (?)"
lheckemann Oct 18, 2017
7acb145
Move sound globals to sound_common
lheckemann Oct 18, 2017
cc64584
Remove dead definitions from sound.hpp
lheckemann Oct 18, 2017
662bed6
Move all sound init to init_game
lheckemann Oct 18, 2017
245a322
Remove music logic from map loading
lheckemann Oct 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ set (Windows 0)
set (Linux 0)
set (NOT_DWORD_DEFINED 0)
if( NOT WIN32 )
set(FLAGS "-Wall -Werror=write-strings -ffast-math -funroll-loops -fstrict-aliasing")
set(RELEASE_FLAGS "-O3")
set(DEBUG_FLAGS "-g")
if(PANDORA)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall ")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin -fsingle-precision-constant")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g -fuse-ld=gold -fuse-linker-plugin -fsingle-precision-constant")
# Pandora-specific optimisations
set(FLAGS "${FLAGS} -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fuse-linker-plugin -fuse-ld=gold -fsingle-precision-constant")
else()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pg -ffast-math -funroll-loops -fstrict-aliasing")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pg")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -fstrict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
# Enable profiling when debugging
set(DEBUG_FLAGS "-pg")
endif()
if (APPLE)
set (Apple 1)
Expand All @@ -77,21 +76,22 @@ if( NOT WIN32 )
set(MACOSX_BUNDLE_BUNDLE_VERSION 2.0.2)
set(MACOSX_BUNDLE_ICON_FILE "barony.icns")
#set(MACOSX_BUNDLE_ICON_FILE "game.icns")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else()
set (Apple 0)
set (Linux 1) #TODO: Should not assume this? What if BSD/DOS/whatever-have-you?
set (NOT_DWORD_DEFINED 1)
if (NOT DISABLE_MALIGN_DOUBLE) #Only compile with -malign-double if not told to disable. Pass via command line flags.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -malign-double")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -malign-double")
set(FLAGS "${FLAGS} -malign-double")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,-rpath=$ORIGIN -Wno-write-strings")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wl,-rpath=$ORIGIN -Wno-write-strings")
set(FLAGS "${FLAGS} -rdynamic -Wl,-rpath=$ORIGIN")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS} -std=c++11")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
else()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pg -O3 -ffast-math -funroll-loops -malign-double -fstrict-aliasing -mwindows")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -funroll-loops -malign-double -fstrict-aliasing -mwindows")
Expand Down
13 changes: 10 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ if( WIN32 )
"${CMAKE_CURRENT_SOURCE_DIR}/wingameicon.o"
)
endif()
if (FMOD)
list(APPEND GAME_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sound_fmod.cpp")
elseif(OPENAL)
list(APPEND GAME_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sound_openal.cpp")
else()
list(APPEND GAME_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sound_null.cpp")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ifdefs in the sourcecode itself might be better for Visual Studio.


list(APPEND GAME_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound_game.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/collision.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/light.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/maps.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cursors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/draw.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/opengl.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/objects.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound_common.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/list.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/files.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/items.cpp"
Expand Down Expand Up @@ -118,7 +125,7 @@ list(APPEND EDITOR_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/hash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/files.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/editor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/sound_null.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/entity_shared.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/stat_editor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/stat_shared.cpp"
Expand Down
35 changes: 7 additions & 28 deletions src/acthudweapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,9 @@ void actHudArm(Entity* my)
my->pitch = -17 * PI / 32;
}

#ifdef HAVE_FMOD
FMOD_CHANNEL* bowDrawingSound = NULL;
FMOD_BOOL bowDrawingSoundPlaying = 0;
#elif defined HAVE_OPENAL
OPENAL_SOUND* bowDrawingSound = NULL;
ALboolean bowDrawingSoundPlaying = 0;
#ifdef SOUND
Channel* bowDrawingSound = NULL;
bool bowDrawingSoundPlaying = 0;
#else
// implement bow drawing timer via SDL_GetTicks()
bool bowDrawingSound = false;
Expand Down Expand Up @@ -298,16 +295,8 @@ void actHudWeapon(Entity* my)
#ifdef SOUND
if ( bowDrawingSoundPlaying && bowDrawingSound )
{
unsigned int position = 0;
unsigned int length = 0;
#ifdef HAVE_OPENAL
OPENAL_Channel_GetPosition(bowDrawingSound, &position);
OPENAL_Sound_GetLength(sounds[246], &length);

#else
FMOD_Channel_GetPosition(bowDrawingSound, &position, FMOD_TIMEUNIT_MS);
FMOD_Sound_GetLength(sounds[246], &length, FMOD_TIMEUNIT_MS);
#endif
unsigned int position = Channel_GetPosition(bowDrawingSound);
unsigned int length = Sound_GetLength(sounds[246]);
if ( position >= length / 4 )
{
my->sprite++;
Expand Down Expand Up @@ -395,13 +384,7 @@ void actHudWeapon(Entity* my)
#ifdef SOUND
if ( bowDrawingSound )
{
#ifdef HAVE_OPENAL
ALboolean tempBool = bowDrawingSoundPlaying;
OPENAL_Channel_IsPlaying(bowDrawingSound, &bowDrawingSoundPlaying);
#else
FMOD_BOOL tempBool = bowDrawingSoundPlaying;
FMOD_Channel_IsPlaying(bowDrawingSound, &bowDrawingSoundPlaying);
#endif
bool tempBool = Channel_IsPlaying(bowDrawingSound);
if ( tempBool && !bowDrawingSoundPlaying )
{
bowFire = true;
Expand Down Expand Up @@ -629,11 +612,7 @@ void actHudWeapon(Entity* my)
#ifdef SOUND
if ( bowDrawingSoundPlaying && bowDrawingSound )
{
#ifdef HAVE_OPENAL
OPENAL_Channel_Stop(bowDrawingSound);
#else
FMOD_Channel_Stop(bowDrawingSound);
#endif
Channel_Stop(bowDrawingSound);
bowDrawingSoundPlaying = 0;
bowDrawingSound = NULL;
}
Expand Down
61 changes: 3 additions & 58 deletions src/actmonster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,17 +1239,10 @@ void actMonster(Entity* my)
}
if ( foundlights )
{
#ifdef HAVE_FMOD
if ( MONSTER_SOUND )
{
FMOD_Channel_Stop(MONSTER_SOUND);
Channel_Stop(MONSTER_SOUND);
}
#elif defined HAVE_OPENAL
if ( MONSTER_SOUND )
{
OPENAL_Channel_Stop(MONSTER_SOUND);
}
#endif
int c;
for ( c = 0; c < MAXPLAYERS; c++ )
{
Expand Down Expand Up @@ -1439,17 +1432,10 @@ void actMonster(Entity* my)
}

// die
#ifdef HAVE_FMOD
if ( MONSTER_SOUND )
{
FMOD_Channel_Stop(MONSTER_SOUND);
Channel_Stop(MONSTER_SOUND);
}
#elif defined HAVE_OPENAL
if ( MONSTER_SOUND )
{
OPENAL_Channel_Stop(MONSTER_SOUND);
}
#endif
myStats = my->getStats();
switch ( myStats->type )
{
Expand Down Expand Up @@ -1569,51 +1555,10 @@ void actMonster(Entity* my)
// check to see if monster can scream again
if ( MONSTER_SOUND != NULL )
{
#ifdef HAVE_FMOD
FMOD_BOOL playing;
FMOD_Channel_IsPlaying(MONSTER_SOUND, &playing);
if (!playing)
{
MONSTER_SOUND = NULL;
}
else
{
for ( c = 0; c < numsounds; c++ )
{
/*if( sounds[c] == Mix_GetChunk(MONSTER_SOUND) && ( c<MONSTER_SPOTSND || c>=MONSTER_SPOTSND+MONSTER_SPOTVAR ) ) { //TODO: Is this necessary? If so, port it to FMOD or find a workaround.
MONSTER_SOUND = -1;
break;
}*/
FMOD_BOOL playing = true;
FMOD_Channel_IsPlaying(MONSTER_SOUND, &playing);
if (!playing)
{
MONSTER_SOUND = NULL;
break;
}
}
}
#elif defined HAVE_OPENAL
ALboolean playing;
OPENAL_Channel_IsPlaying(MONSTER_SOUND, &playing);
if (!playing)
if (!Channel_IsPlaying(MONSTER_SOUND))
{
MONSTER_SOUND = NULL;
}
else
{
for ( c = 0; c < numsounds; c++ )
{
ALboolean playing = true;
OPENAL_Channel_IsPlaying(MONSTER_SOUND, &playing);
if (!playing)
{
MONSTER_SOUND = NULL;
break;
}
}
}
#endif
}

// remove broken equipment
Expand Down
3 changes: 2 additions & 1 deletion src/book.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
-------------------------------------------------------------------------------*/

#include "main.hpp"
#include "files.hpp"
#include "game.hpp"
#include "interface/interface.hpp"
#include "book.hpp"
Expand All @@ -26,7 +27,7 @@ int numbooks = 0;

//book_t *book_space_ninjas = NULL;

int getBook(char* booktitle)
int getBook(const char* booktitle)
{
int c;
for ( c = 0; c < numbooks; c++ )
Expand Down
2 changes: 1 addition & 1 deletion src/book.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ void createBooks();
void createBook(book_t* book); //Take's a book and generates all of its pages.

void formatTitle(book_t* book); //Prepares the book's title for rendering in the book GUI.
int getBook(char* booktitle); // returns the appearance index number for the book with the given title
int getBook(const char* booktitle); // returns the appearance index number for the book with the given title
Loading