File confec.cpp changed (mode: 100644) (index 516208d..613fd8c) |
... |
... |
struct SpecialItem { |
456 |
456 |
int32_t special_item_result = 0; |
int32_t special_item_result = 0; |
457 |
457 |
|
|
458 |
458 |
// App variable definitions. |
// App variable definitions. |
459 |
|
std::string app_version = "v0.6.4"; |
|
|
459 |
|
std::string app_version = "v0.6.5"; |
460 |
460 |
#ifdef __DEMO__ |
#ifdef __DEMO__ |
461 |
461 |
app_version += " demo"; |
app_version += " demo"; |
462 |
462 |
std::string app_name = "Confectioner Engine Demo"; |
std::string app_name = "Confectioner Engine Demo"; |
|
... |
... |
std::vector<SpecialItem> special_items; |
474 |
474 |
std::string language = "en"; |
std::string language = "en"; |
475 |
475 |
|
|
476 |
476 |
// Whitelist these languages. Generally, every game should support these. |
// Whitelist these languages. Generally, every game should support these. |
477 |
|
std::vector<std::string> language_whitelist = { "en", "zh" }; |
|
|
477 |
|
std::vector<std::string> language_whitelist = { "en", "el", "zh" }; |
478 |
478 |
|
|
479 |
479 |
// Use these mods. The "game" folder is layered on top of the base data. |
// Use these mods. The "game" folder is layered on top of the base data. |
480 |
480 |
std::vector<std::string> mod_paths = { "game" }; |
std::vector<std::string> mod_paths = { "game" }; |
|
... |
... |
void Tick(); |
812 |
812 |
|
|
813 |
813 |
void TurboSleep(); |
void TurboSleep(); |
814 |
814 |
|
|
815 |
|
void UpdateRimSun(); |
|
|
815 |
|
void UpdateSun(); |
816 |
816 |
|
|
817 |
817 |
void UpdateRichPresence(); |
void UpdateRichPresence(); |
818 |
818 |
|
|
|
... |
... |
int main( int argc, char* argv[] ){ |
926 |
926 |
is_steam_china = true; |
is_steam_china = true; |
927 |
927 |
// Determine language. |
// Determine language. |
928 |
928 |
std::string game_lang = SteamApps()->GetCurrentGameLanguage(); |
std::string game_lang = SteamApps()->GetCurrentGameLanguage(); |
|
929 |
|
if( game_lang == "greek" ) language = "el"; |
929 |
930 |
if( game_lang == "schinese" || game_lang == "tchinese" ) |
if( game_lang == "schinese" || game_lang == "tchinese" ) |
930 |
931 |
language = "zh"; |
language = "zh"; |
931 |
932 |
// Register the text handler. |
// Register the text handler. |
|
... |
... |
int main( int argc, char* argv[] ){ |
941 |
942 |
// Determine language. Reset locale to deal with "unholy things" in GCC. |
// Determine language. Reset locale to deal with "unholy things" in GCC. |
942 |
943 |
std::string loc = setlocale( LC_ALL, "" ); |
std::string loc = setlocale( LC_ALL, "" ); |
943 |
944 |
setlocale( LC_ALL, "C" ); |
setlocale( LC_ALL, "C" ); |
944 |
|
if( ( loc.length() >= 2 && loc.substr( 0, 2 ) == "zh" ) |
|
|
945 |
|
if( loc.length() >= 2 ){ |
|
946 |
|
if( loc.substr( 0, 2 ) == "el" |
|
947 |
|
|| ( loc.length() >= 5 && loc.substr( 0, 5 ) == "Greek" ) ){ |
|
948 |
|
language = "el"; |
|
949 |
|
} |
|
950 |
|
if( loc.substr( 0, 2 ) == "zh" |
945 |
951 |
|| ( loc.length() >= 7 && loc.substr( 0, 7 ) == "Chinese" ) ){ |
|| ( loc.length() >= 7 && loc.substr( 0, 7 ) == "Chinese" ) ){ |
946 |
|
language = "zh"; |
|
|
952 |
|
language = "zh"; |
|
953 |
|
} |
947 |
954 |
} |
} |
948 |
955 |
#endif |
#endif |
949 |
956 |
|
|
|
... |
... |
void TurboSleep(){ |
4088 |
4095 |
} |
} |
4089 |
4096 |
|
|
4090 |
4097 |
// Update the sun position for sprite rim lighting. |
// Update the sun position for sprite rim lighting. |
4091 |
|
void UpdateRimSun(){ |
|
|
4098 |
|
void UpdateSun(){ |
4092 |
4099 |
float angle = player_time * 6.283; |
float angle = player_time * 6.283; |
4093 |
4100 |
auto sun = linalg::normalize( linalg::vec<float,2>( |
auto sun = linalg::normalize( linalg::vec<float,2>( |
4094 |
4101 |
std::sin( angle ), |
std::sin( angle ), |
|
... |
... |
void UpdateRimSun(){ |
4096 |
4103 |
) ); |
) ); |
4097 |
4104 |
// Manhattan normalize. |
// Manhattan normalize. |
4098 |
4105 |
sun /= std::max( std::abs( sun.x ), std::abs( sun.y ) ); |
sun /= std::max( std::abs( sun.x ), std::abs( sun.y ) ); |
4099 |
|
if( sun.y > 0.0f ) sun *= 1.0f - std::min( sun.y / 0.2f, 1.0f ); |
|
|
4106 |
|
if( sun.y > 0.0f ){ |
|
4107 |
|
sun *= 1.0f - std::min( sun.y / 0.2f, 1.0f ); |
|
4108 |
|
angle = 3.14159; |
|
4109 |
|
} |
|
4110 |
|
// Angle the rim light. |
4100 |
4111 |
glUniform2f( |
glUniform2f( |
4101 |
4112 |
glGetUniformLocation( rimlitSpritePipeline.programObject, "u_sun" ), |
glGetUniformLocation( rimlitSpritePipeline.programObject, "u_sun" ), |
4102 |
4113 |
sun.x, |
sun.x, |
4103 |
4114 |
sun.y |
sun.y |
4104 |
4115 |
); |
); |
|
4116 |
|
// TODO: I don't know what the hell the particles are doing. |
|
4117 |
|
fgl::lightMatrix = |
|
4118 |
|
linalg::rotation_matrix( fgl::eulerToQuat( 0.0, -1.57, 1.57 ) ); |
4105 |
4119 |
} |
} |
4106 |
4120 |
|
|
4107 |
4121 |
void UpdateRichPresence(){ |
void UpdateRichPresence(){ |
|
... |
... |
void Render(){ |
4717 |
4731 |
DrawFloorParticles(); |
DrawFloorParticles(); |
4718 |
4732 |
// Draw the entities with rim lighting. |
// Draw the entities with rim lighting. |
4719 |
4733 |
fgl::setPipeline( rimlitSpritePipeline ); |
fgl::setPipeline( rimlitSpritePipeline ); |
4720 |
|
UpdateRimSun(); |
|
|
4734 |
|
UpdateSun(); |
4721 |
4735 |
if( multiplayer ) |
if( multiplayer ) |
4722 |
4736 |
world.drawEntities( ws_entities ); |
world.drawEntities( ws_entities ); |
4723 |
4737 |
else |
else |
|
... |
... |
void SimulateParticles( double d ){ |
5046 |
5060 |
), |
), |
5047 |
5061 |
gibs.end() |
gibs.end() |
5048 |
5062 |
); |
); |
5049 |
|
// Angle the light to best accentuate the particles. |
|
5050 |
|
fgl::lightMatrix = |
|
5051 |
|
linalg::rotation_matrix( fgl::eulerToQuat( 0.0, -1.5, 1.5 ) ); |
|
5052 |
5063 |
} |
} |
5053 |
5064 |
|
|
5054 |
5065 |
void DrawFloorParticles(){ |
void DrawFloorParticles(){ |
|
... |
... |
void GameLoop( double d ){ |
5965 |
5976 |
} |
} |
5966 |
5977 |
// Draw the entities with rim lighting. |
// Draw the entities with rim lighting. |
5967 |
5978 |
fgl::setPipeline( rimlitSpritePipeline ); |
fgl::setPipeline( rimlitSpritePipeline ); |
5968 |
|
UpdateRimSun(); |
|
|
5979 |
|
UpdateSun(); |
5969 |
5980 |
if( multiplayer ) |
if( multiplayer ) |
5970 |
5981 |
world.drawEntities( ws_entities ); |
world.drawEntities( ws_entities ); |
5971 |
5982 |
else |
else |