File confec.cpp changed (mode: 100644) (index 5581b7c..1a887bb) |
... |
... |
void UpdateInventoryService(); |
773 |
773 |
|
|
774 |
774 |
void ModUpload( std::string title ); |
void ModUpload( std::string title ); |
775 |
775 |
|
|
|
776 |
|
FILE *FileOpen( const char* filename, const char* modes ); |
|
777 |
|
|
776 |
778 |
void Render(); |
void Render(); |
777 |
779 |
|
|
778 |
780 |
void MakeGibs( double x, double y, linalg::vec<double,3> vel, int n ); |
void MakeGibs( double x, double y, linalg::vec<double,3> vel, int n ); |
|
... |
... |
void DeleteAllUserFiles(){ |
2443 |
2445 |
remove( ( user_data_path + "/" + user_recipes ).c_str() ); |
remove( ( user_data_path + "/" + user_recipes ).c_str() ); |
2444 |
2446 |
} |
} |
2445 |
2447 |
|
|
|
2448 |
|
// Called when a fighter hits something. |
2446 |
2449 |
void HitCallback( fworld::Entity *ent_a, fworld::Entity *ent_b, int damage ){ |
void HitCallback( fworld::Entity *ent_a, fworld::Entity *ent_b, int damage ){ |
|
2450 |
|
if( ent_b->task == fworld::TASK_SLEEP ){ |
|
2451 |
|
// Wake the entity. |
|
2452 |
|
ent_b->task = fworld::TASK_NONE; |
|
2453 |
|
ent_b->stun = 0.0; |
|
2454 |
|
if( world.followEntity >= 0 && world.followEntity < world.entities.size() |
|
2455 |
|
&& ent_b == &world.entities[world.followEntity] ){ |
|
2456 |
|
// The player is hit, so turn off sleep mode. |
|
2457 |
|
sleep_mode = false; |
|
2458 |
|
} |
|
2459 |
|
} |
2447 |
2460 |
MakeGibs( |
MakeGibs( |
2448 |
2461 |
ent_b->x + 0.5, |
ent_b->x + 0.5, |
2449 |
2462 |
ent_b->y + 1.0 - ent_b->height * 0.75 / world.tileSize, |
ent_b->y + 1.0 - ent_b->height * 0.75 / world.tileSize, |
|
... |
... |
void ModUpload( std::string title ){ |
4061 |
4074 |
#endif |
#endif |
4062 |
4075 |
} |
} |
4063 |
4076 |
|
|
|
4077 |
|
// fopen replacement that attempts to open the file from multiple locations. |
|
4078 |
|
FILE *FileOpen( const char* filename, const char* modes ){ |
|
4079 |
|
// Check if filename starts with the base data path. |
|
4080 |
|
std::string str_file = filename, str_data = data_path + "/"; |
|
4081 |
|
if( str_file.length() >= str_data.length() |
|
4082 |
|
&& str_file.substr( 0, str_data.length() ) == str_data ){ |
|
4083 |
|
// TODO: String replacement and iterate through mod paths. |
|
4084 |
|
} |
|
4085 |
|
// Fall back to open the path specified. |
|
4086 |
|
return fopen( filename, modes ); |
|
4087 |
|
} |
|
4088 |
|
|
4064 |
4089 |
void Render(){ |
void Render(){ |
4065 |
4090 |
double d = fgl::deltaTime(); |
double d = fgl::deltaTime(); |
4066 |
4091 |
|
|