Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Axanery committed Nov 16, 2024
1 parent 15ba234 commit 997e3ef
Show file tree
Hide file tree
Showing 9 changed files with 687 additions and 426 deletions.
967 changes: 588 additions & 379 deletions guides/Documentation.htm

Large diffs are not rendered by default.

75 changes: 48 additions & 27 deletions include/Engine/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,53 @@ class Application {
static string ParseGameVersion(XMLNode* versionNode);
static void LoadGameInfo();
static int HandleAppEvents(void* data, SDL_Event* event);
static void DrawDevString(const char* string, int x, int y, int align, bool isSelected);
static void OpenDevMenu();
static void CloseDevMenu();
static void SetBlendColor(int color);
static void DrawRectangle(float x, float y, float width, float height, int color, int alpha, bool screenRelative);
static void DevMenu_DrawMainMenu();
static void DevMenu_MainMenu();
static void DevMenu_CategorySelectMenu();
static void DevMenu_SceneSelectMenu();
static void DevMenu_SettingsMenu();
static void DevMenu_ModsMenu();

public:
static vector<char*> CmdLineArgs;
static INI* Settings;
static char SettingsFile[4096];
static XMLNode* GameConfig;
static int TargetFPS;
static float CurrentFPS;
static bool Running;
static bool GameStart;
static SDL_Window* Window;
static char WindowTitle[256];
static int WindowWidth;
static int WindowHeight;
static int DefaultMonitor;
static Platforms Platform;
static char EngineVersion[256];
static char GameTitle[256];
static char GameTitleShort[256];
static char GameVersion[256];
static char GameDescription[256];
static int UpdatesPerFrame;
static bool Stepper;
static bool Step;
static int MasterVolume;
static int MusicVolume;
static int SoundVolume;
static int StartSceneNum;
static bool DevMenuActivated;
static vector<char*> CmdLineArgs;
static INI* Settings;
static char SettingsFile[4096];
static XMLNode* GameConfig;
static int TargetFPS;
static float CurrentFPS;
static bool Running;
static bool GameStart;
static SDL_Window* Window;
static char WindowTitle[256];
static int WindowWidth;
static int WindowHeight;
static int DefaultMonitor;
static Platforms Platform;
static char EngineVersion[256];
static char GameTitle[256];
static char GameTitleShort[256];
static char GameVersion[256];
static char GameDescription[256];
static int UpdatesPerFrame;
static bool Stepper;
static bool Step;
static int MasterVolume;
static int MusicVolume;
static int SoundVolume;
static int StartSceneNum;
static bool DevMenuActivated;
static int ViewableVariableCount;
static ViewableVariable ViewableVariableList[64];
static DeveloperMenu DevMenu;
static int DeveloperDarkFont;
static int DeveloperLightFont;
static int ReservedSlotIDs;
static bool DevShowHitboxes;

static void Init(int argc, char* args[]);
static void SetTargetFrameRate(int targetFPS);
Expand Down Expand Up @@ -85,6 +103,9 @@ class Application {
static void SaveSettings();
static void SaveSettings(const char* filename);
static void SetSettingsFilename(const char* filename);
static void AddViewableVariable(const char* name, void* value, int type, int min, int max);
static Uint16* UTF8toUTF16(const char* utf8String);
static int LoadDevFont(const char* fileName);
};

#endif /* ENGINE_APPLICATION_H */
6 changes: 6 additions & 0 deletions include/Engine/InputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ class InputManager {
static bool IsAnyActionHeld(unsigned playerID, unsigned device);
static bool IsAnyActionPressed(unsigned playerID, unsigned device);
static bool IsAnyActionReleased(unsigned playerID, unsigned device);
static bool IsActionHeldByAny(unsigned actionID);
static bool IsActionPressedByAny(unsigned actionID);
static bool IsActionReleasedByAny(unsigned actionID);
static bool IsActionHeldByAny(unsigned actionID, unsigned device);
static bool IsActionPressedByAny(unsigned actionID, unsigned device);
static bool IsActionReleasedByAny(unsigned actionID, unsigned device);
static bool IsPlayerUsingDevice(unsigned playerID, unsigned device);
static float GetAnalogActionInput(unsigned playerID, unsigned actionID);
static InputBind* GetPlayerInputBind(unsigned playerID, unsigned actionID, unsigned index, bool isDefault);
Expand Down
1 change: 1 addition & 0 deletions include/Engine/Math/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Math {
static int Tan256(int angle);
static int ASin256(int angle);
static int ACos256(int angle);
static unsigned int ArcTanLookup(int X, int Y);
static int CeilPOT(int n);
static float Abs(float n);
static float Max(float a, float b);
Expand Down
2 changes: 1 addition & 1 deletion include/Engine/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Scene {
static bool CheckObjectCollisionBox(Entity* thisEntity, CollisionBox* thisHitbox, Entity* otherEntity, CollisionBox* otherHitbox, bool setValues);
static bool CheckObjectCollisionPlatform(Entity* thisEntity, CollisionBox* thisHitbox, Entity* otherEntity, CollisionBox* otherHitbox, bool setValues);
static bool ObjectTileCollision(Entity* entity, int cLayers, int cMode, int cPlane, int xOffset, int yOffset, bool setPos);
static bool ObjectTileGrip(Entity* entity, int cLayers, int cMode, int cPlane, float xOffset, float yOffset, float tolerance);
static bool ObjectTileGrip(Entity* entity, int cLayers, int cMode, int cPlane, int xOffset, int yOffset, float tolerance);
static void ProcessObjectMovement(Entity* entity, CollisionBox* outerBox, CollisionBox* innerBox);
static void ProcessPathGrip();
static void ProcessAirCollision_Down();
Expand Down
4 changes: 4 additions & 0 deletions include/Engine/Types/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Entity {
float OnScreenRegionBottom = 0.0f;
int ViewRenderFlag = 0xFFFFFFFF;
int ViewOverrideFlag = 0;
int Visible = true;
float RenderRegionW = 0.0f;
float RenderRegionH = 0.0f;
float RenderRegionTop = 0.0f;
Expand All @@ -54,6 +55,7 @@ class Entity {
float ScaleY = 1.0;
float Rotation = 0.0;
float Alpha = 1.0;
int BlendMode = BlendMode_NORMAL;
int AutoPhysics = false;
int Priority = 0;
int PriorityListIndex = -1;
Expand All @@ -67,6 +69,8 @@ class Entity {
int CurrentFrameCount = 0;
float AnimationSpeedMult = 1.0;
int AnimationSpeedAdd = 0;
int PrevAnimation = 0;
int RotationStyle = ROTSTYLE_NONE;
int AutoAnimate = true;
float AnimationSpeed = 0.0;
float AnimationTimer = 0.0;
Expand Down
33 changes: 17 additions & 16 deletions source/Engine/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ vector<char*> Application::CmdLineArgs;

XMLNode* Application::GameConfig = NULL;

float Application::FPS = 60.f;
int TargetFPS = 60;
bool Application::Running = false;
bool Application::GameStart = false;
Expand Down Expand Up @@ -1482,7 +1481,9 @@ void Application::InitSettings(const char* filename) {
Application::Settings->SetInteger("audio", "soundVolume", 0);

Application::Settings->SetBool("dev", "devMenu", false);
Application::Settings->SetBool("dev", "writeToFile", false);
#if WIN32 || MACOSX || LINUX || SWITCH
Application::Settings->SetBool("dev", "writeToFile", true);
#endif
Application::Settings->SetBool("dev", "viewPerformance", false);
Application::Settings->SetBool("dev", "donothing", false);
Application::Settings->SetInteger("dev", "fastForward", 6);
Expand Down Expand Up @@ -1575,7 +1576,7 @@ int Application::HandleAppEvents(void* data, SDL_Event* event) {
}
}

PRIVATE STATIC void Application::AddViewableVariable(const char* name, void* value, int type, int min, int max) {
void Application::AddViewableVariable(const char* name, void* value, int type, int min, int max) {
if (Application::ViewableVariableCount < VIEWABLEVARIABLE_COUNT) {
ViewableVariable* viewVar = &Application::ViewableVariableList[Application::ViewableVariableCount++];

Expand All @@ -1595,7 +1596,7 @@ PRIVATE STATIC void Application::AddViewableVariable(const char* name, void* val
}
}

PUBLIC STATIC Uint16* Application::UTF8toUTF16(const char* utf8String) {
Uint16* Application::UTF8toUTF16(const char* utf8String) {
size_t len = strlen(utf8String);
Uint16* utf16String = (Uint16*)malloc((len + 1) * sizeof(Uint16));
size_t i = 0, j = 0;
Expand All @@ -1617,7 +1618,7 @@ PUBLIC STATIC Uint16* Application::UTF8toUTF16(const char* utf8String) {
return utf16String;
}

PUBLIC STATIC int Application::LoadDevFont(const char* fileName) {
int Application::LoadDevFont(const char* fileName) {
ResourceType* resource = new (std::nothrow) ResourceType();
resource->FilenameHash = CRC32::EncryptString(fileName);
resource->UnloadPolicy = SCOPE_GAME;
Expand All @@ -1640,7 +1641,7 @@ PUBLIC STATIC int Application::LoadDevFont(const char* fileName) {
return (int)index;
}

PRIVATE STATIC void Application::DrawDevString(const char* string, int x, int y, int align, bool isSelected) {
void Application::DrawDevString(const char* string, int x, int y, int align, bool isSelected) {
x += Scene::Views[0].X;
y += Scene::Views[0].Y;

Expand Down Expand Up @@ -1752,7 +1753,7 @@ PRIVATE STATIC void Application::DrawDevString(const char* string, int x, int y,
}
}

PRIVATE STATIC void Application::OpenDevMenu() {
void Application::OpenDevMenu() {
DevMenu.State = Application::DevMenu_MainMenu;
DevMenu.Selection = 0;
DevMenu.ScrollPos = 0;
Expand All @@ -1769,7 +1770,7 @@ PRIVATE STATIC void Application::OpenDevMenu() {
Application::DevMenuActivated = true;
}

PRIVATE STATIC void Application::CloseDevMenu() {
void Application::CloseDevMenu() {
Application::DevMenuActivated = false;

AudioManager::AudioUnpauseAll();
Expand All @@ -1779,14 +1780,14 @@ PRIVATE STATIC void Application::CloseDevMenu() {
AudioManager::Unlock();
}

PRIVATE STATIC void Application::SetBlendColor(int color) {
void Application::SetBlendColor(int color) {
Graphics::SetBlendColor(
(color >> 16 & 0xFF) / 255.f,
(color >> 8 & 0xFF) / 255.f,
(color & 0xFF) / 255.f, 1.0);
}

PRIVATE STATIC void Application::DrawRectangle(float x, float y, float width, float height, int color, int alpha, bool screenRelative) {
void Application::DrawRectangle(float x, float y, float width, float height, int color, int alpha, bool screenRelative) {
if (screenRelative) {
x += Scene::Views[0].X;
y += Scene::Views[0].Y;
Expand All @@ -1798,7 +1799,7 @@ PRIVATE STATIC void Application::DrawRectangle(float x, float y, float width, fl
Graphics::FillRectangle(x, y, width, height);
}

PRIVATE STATIC void Application::DevMenu_DrawMainMenu() {
void Application::DevMenu_DrawMainMenu() {
const int selectionCount = 6;
bool isSelected[] = { false, false, false, false, false, false };
const char* selectionNames[] = { "Resume", "Restart", "Stage Select", "Settings", "Mods", "Exit" };
Expand All @@ -1825,7 +1826,7 @@ PRIVATE STATIC void Application::DevMenu_DrawMainMenu() {
y += 20;
}

PRIVATE STATIC void Application::DevMenu_MainMenu() {
void Application::DevMenu_MainMenu() {
const int selectionCount = 6;
DevMenu_DrawMainMenu();

Expand Down Expand Up @@ -1940,7 +1941,7 @@ PRIVATE STATIC void Application::DevMenu_MainMenu() {
}
}

PRIVATE STATIC void Application::DevMenu_CategorySelectMenu() {
void Application::DevMenu_CategorySelectMenu() {
const int selectionCount = 6;
DevMenu_DrawMainMenu();

Expand Down Expand Up @@ -2080,7 +2081,7 @@ PRIVATE STATIC void Application::DevMenu_CategorySelectMenu() {
}
}

PRIVATE STATIC void Application::DevMenu_SceneSelectMenu() {
void Application::DevMenu_SceneSelectMenu() {
DevMenu_DrawMainMenu();

View view = Scene::Views[0];
Expand Down Expand Up @@ -2200,10 +2201,10 @@ PRIVATE STATIC void Application::DevMenu_SceneSelectMenu() {
}
}

PRIVATE STATIC void Application::DevMenu_SettingsMenu() {
void Application::DevMenu_SettingsMenu() {

}

PRIVATE STATIC void Application::DevMenu_ModsMenu() {
void Application::DevMenu_ModsMenu() {

}
23 changes: 21 additions & 2 deletions source/Engine/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,27 @@ bool InputManager::IsAnyActionReleased(unsigned playerID, unsigned device) {

return player.IsAnyInputReleased(device);
}
bool InputManager::IsActionHeldByAny(unsigned actionID) {
for (unsigned playerID = 0; playerID <= Players.size() - 1; playerID++) {
InputPlayer& player = Players[playerID];
if (player.IsInputHeld(actionID)) return true;
}
return false;
}
bool InputManager::IsActionPressedByAny(unsigned actionID) {
for (unsigned playerID = 0; playerID <= Players.size() - 1; playerID++) {
InputPlayer& player = Players[playerID];
if (player.IsInputPressed(actionID)) return true;
}
return false;
}
bool InputManager::IsActionReleasedByAny(unsigned actionID) {
for (unsigned playerID = 0; playerID <= Players.size() - 1; playerID++) {
InputPlayer& player = Players[playerID];
if (player.IsInputReleased(actionID)) return true;
}
return false;
}
bool InputManager::IsActionHeldByAny(unsigned actionID, unsigned device) {
for (unsigned playerID = 0; playerID <= Players.size() - 1; playerID++) {
InputPlayer& player = Players[playerID];
Expand All @@ -796,8 +817,6 @@ bool InputManager::IsActionReleasedByAny(unsigned actionID, unsigned device) {

return false;
}
bool InputManager::IsPlayerUsingDevice(unsigned playerID, unsigned device) {

bool InputManager::IsPlayerUsingDevice(unsigned playerID, unsigned device) {
if (playerID >= Players.size() || device >= InputDevice_MAX)
return false;
Expand Down
2 changes: 1 addition & 1 deletion source/Engine/Math/Math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int Math::ACos256(int angle) {
return -ACos256LookupTable[-angle];
return ACos256LookupTable[angle];
}
PUBLIC STATIC unsigned int Math::ArcTanLookup(int X, int Y) {
unsigned int Math::ArcTanLookup(int X, int Y) {
int x = abs(X);
int y = abs(Y);

Expand Down

0 comments on commit 997e3ef

Please sign in to comment.