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

LE changes #63

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ else()
# Always generate debug information
add_compile_options(-g)
add_link_options(-g)

# Add _DEBUG flag
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
endif()

# this is crucial to include libs first
Expand Down
Binary file modified src/apps/engine/rsrc/icon1.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion src/apps/engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ int main(int argc, char *argv[])

std::shared_ptr<storm::OSWindow> window =
storm::OSWindow::Create(width, height, preferred_display, fullscreen, show_borders);
window->SetTitle("Sea Dogs");
window->SetTitle("Caribbean Legend");
window->Subscribe(HandleWindowEvent);
window->Show();
core_private->SetWindow(window);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class BITextInfo final
float fScale;
int32_t nFont;
uint32_t dwColor;
int32_t nAlign;
bool bShadow;

ATTRIBUTES *pARefresh;
Expand Down Expand Up @@ -91,8 +92,8 @@ class BIUtils
static bool ReadStringFromAttr(ATTRIBUTES *pA, const char *name, char *buf, int32_t bufSize, const char *defVal);
static const char *GetStringFromAttr(ATTRIBUTES *pA, const char *name, const char *defVal);
static int32_t GetTextureFromAttr(VDX9RENDER *rs, ATTRIBUTES *pA, const char *sAttrName);
static bool ReadRectFromAttr(ATTRIBUTES *pA, const std::string_view &name, FRECT &rOut, FRECT &rDefault);
static bool ReadRectFromAttr(ATTRIBUTES *pA, const std::string_view &name, RECT &rOut, RECT &rDefault);
static bool ReadRectFromAttr(ATTRIBUTES *pA, const char *name, FRECT &rOut, FRECT &rDefault);
static bool ReadRectFromAttr(ATTRIBUTES *pA, const char *name, RECT &rOut, RECT &rDefault);
static bool ReadPosFromAttr(ATTRIBUTES *pA, const char *name, float &fX, float &fY, float fXDef, float fYDef);
static bool ReadPosFromAttr(ATTRIBUTES *pA, const char *name, int32_t &nX, int32_t &nY, int32_t nXDef, int32_t nYDef);
static int32_t GetAlignmentFromAttr(ATTRIBUTES *pA, const char *name, int32_t nDefAlign);
Expand All @@ -107,7 +108,7 @@ class BIUtils
static bool GetIntervalRect(float fk, const FRECT &r1, const FRECT &r2, FRECT &rOut);

static int32_t GetMaxFromFourLong(int32_t n1, int32_t n2, int32_t n3, int32_t n4);

static float GetFromStr_Float(const char *&pcStr, float fDefault);

static void FillTextInfoArray(VDX9RENDER *pRS, ATTRIBUTES *pA, std::vector<BITextInfo> &tia);
Expand Down
91 changes: 0 additions & 91 deletions src/libs/battle_interface/include/log_and_action.h

This file was deleted.

73 changes: 60 additions & 13 deletions src/libs/battle_interface/src/battle_command.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "battle_command.h"
#include "utils.h"
#include "bi_utils.h"
#include "core.h"
#include "image/img_render.h"
#include "sea/ships_list.h"
Expand All @@ -22,7 +22,7 @@ BICommandList::BICommandList(entid_t eid, ATTRIBUTES *pA, VDX9RENDER *rs)
m_NotePos.x = m_NotePos.y = 0;
m_NoteOffset.x = m_NoteOffset.y = 0;

m_bUpArrow = m_bDownArrow = false;
m_bUpArrow = m_bDownArrow = m_bLeftArrow = m_bRightArrow = false;

m_bActive = false;

Expand Down Expand Up @@ -63,6 +63,13 @@ void BICommandList::Draw()

void BICommandList::Update(int32_t nTopLine, int32_t nCharacterIndex, int32_t nCommandMode)
{

if (m_nCurrentCommandMode != nCommandMode)
{
m_nStartUsedCommandIndex = 0;
m_nSelectedCommandIndex = 0;
}

int32_t nOldSelIndex = 0;
if (nTopLine == m_LeftTopPoint.y && nCharacterIndex == m_nCurrentCommandCharacterIndex &&
m_nCurrentCommandMode == nCommandMode)
Expand All @@ -74,8 +81,6 @@ void BICommandList::Update(int32_t nTopLine, int32_t nCharacterIndex, int32_t nC
m_nCurrentCommandCharacterIndex = nCharacterIndex;
m_nCurrentCommandMode = nCommandMode;

m_nStartUsedCommandIndex = 0;
m_nSelectedCommandIndex = 0;
m_aUsedCommand.clear();
m_aCooldownUpdate.clear();

Expand Down Expand Up @@ -224,9 +229,21 @@ void BICommandList::Init()
FULLRECT(m_frDownArrowUV);
m_pntUpArrowOffset.x = 32;
m_pntUpArrowOffset.y = -34;

m_pntDownArrowOffset0.x = 32;
m_pntDownArrowOffset0.y = 66;
m_pntDownArrowOffset.x = 32;
m_pntDownArrowOffset.y = 66;

m_sLeftRightArrowTexture = "";
m_pntLeftRightArrowSize.x = m_pntLeftRightArrowSize.y = 0;
FULLRECT(m_frLeftArrowUV);
FULLRECT(m_frRightArrowUV);
m_pntLeftArrowOffset.x = 0;
m_pntLeftArrowOffset.y = 0;
m_pntRightArrowOffset.x = 0;
m_pntRightArrowOffset.y = 0;

// default data for active icon
m_sActiveIconTexture = "";
m_pntActiveIconOffset.x = -33;
Expand Down Expand Up @@ -266,8 +283,21 @@ void BICommandList::Init()
m_pntUpDownArrowSize.x, m_pntUpDownArrowSize.y);
BIUtils::ReadPosFromAttr(pAList, "UDArrow_Offset_Up", m_pntUpArrowOffset.x, m_pntUpArrowOffset.y,
m_pntUpArrowOffset.x, m_pntUpArrowOffset.y);
BIUtils::ReadPosFromAttr(pAList, "UDArrow_Offset_Down", m_pntDownArrowOffset.x, m_pntDownArrowOffset.y,
BIUtils::ReadPosFromAttr(pAList, "UDArrow_Offset_Down", m_pntDownArrowOffset.x, m_pntDownArrowOffset.y,
m_pntDownArrowOffset.x, m_pntDownArrowOffset.y);
BIUtils::ReadPosFromAttr(pAList, "UDArrow_Offset_Down0", m_pntDownArrowOffset0.x, m_pntDownArrowOffset0.y,
m_pntDownArrowOffset0.x, m_pntDownArrowOffset0.y);

if (attr = pAList->GetAttribute("LRArrow_Texture"))
m_sLeftRightArrowTexture = attr;
BIUtils::ReadRectFromAttr(pAList, "LRArrow_UV_Left", m_frLeftArrowUV, m_frLeftArrowUV);
BIUtils::ReadRectFromAttr(pAList, "LRArrow_UV_Right", m_frRightArrowUV, m_frRightArrowUV);
BIUtils::ReadPosFromAttr(pAList, "LRArrow_Size", m_pntLeftRightArrowSize.x, m_pntLeftRightArrowSize.y,
m_pntLeftRightArrowSize.x, m_pntLeftRightArrowSize.y);
BIUtils::ReadPosFromAttr(pAList, "LRArrow_Offset_Left", m_pntLeftArrowOffset.x, m_pntLeftArrowOffset.y,
m_pntLeftArrowOffset.x, m_pntLeftArrowOffset.y);
BIUtils::ReadPosFromAttr(pAList, "LRArrow_Offset_Right", m_pntRightArrowOffset.x, m_pntRightArrowOffset.y,
m_pntRightArrowOffset.x, m_pntRightArrowOffset.y);

// set values for the menu activity icon
if (attr = pAList->GetAttribute("ActiveIcon_Texture"))
Expand Down Expand Up @@ -314,9 +344,9 @@ void BICommandList::Init()
m_nIconShowMaxQuantity = 5;
}

int32_t BICommandList::AddToIconList(int32_t nTextureNum, int32_t nNormPictureNum, int32_t nSelPictureNum, int32_t nCooldownPictureNum,
int32_t nCharacterIndex, const char *pcCommandName, int32_t nTargetIndex,
const char *pcLocName, const char *pcNoteName)
int32_t BICommandList::AddToIconList(int32_t nTextureNum, int32_t nNormPictureNum, int32_t nSelPictureNum,
int32_t nCooldownPictureNum, int32_t nCharacterIndex, const char *pcCommandName,
int32_t nTargetIndex, const char *pcLocName, const char *pcNoteName)
{
int32_t n;
// filtering out already used objects
Expand Down Expand Up @@ -361,7 +391,8 @@ int32_t BICommandList::AddToIconList(int32_t nTextureNum, int32_t nNormPictureNu
return 1;
}

void BICommandList::AddAdditiveToIconList(int32_t nTextureNum, int32_t nPictureNum, float fDist, float fWidth, float fHeight)
void BICommandList::AddAdditiveToIconList(int32_t nTextureNum, int32_t nPictureNum, float fDist, float fWidth,
float fHeight)
{
if (m_aUsedCommand.empty())
return;
Expand Down Expand Up @@ -395,7 +426,7 @@ int32_t BICommandList::IconAdd(int32_t nPictureNum, int32_t nTextureNum, RECT &r
}

int32_t BICommandList::ClockIconAdd(int32_t nForePictureNum, int32_t nBackPictureNum, int32_t nTextureNum, RECT &rpos,
float fFactor)
float fFactor)
{
if (nTextureNum < 0 || nTextureNum >= m_aTexture.size() || nForePictureNum < 0 ||
nForePictureNum >= m_aTexture[nTextureNum].nCols * m_aTexture[nTextureNum].nRows)
Expand Down Expand Up @@ -483,7 +514,7 @@ void BICommandList::UpdateShowIcon()
m_pImgRender->CreateImage(BIType_square, m_sActiveIconTexture.c_str(), 0xFF808080, m_frActiveIconUV2, rPos);

m_bLeftArrow = m_nStartUsedCommandIndex > 0;
m_bRightArrow = false;
m_bRightArrow = m_aUsedCommand.size() - m_nStartUsedCommandIndex > m_nIconShowMaxQuantity;

int32_t i = 0;
for (auto n = m_nStartUsedCommandIndex; n < m_aUsedCommand.size() && i < m_nIconShowMaxQuantity; n++)
Expand Down Expand Up @@ -527,12 +558,28 @@ void BICommandList::UpdateShowIcon()
}
if (m_bDownArrow)
{
rPos.left = m_LeftTopPoint.x + m_pntDownArrowOffset.x;
rPos.top = m_LeftTopPoint.y + m_pntDownArrowOffset.y;
rPos.left = m_bUpArrow ? m_LeftTopPoint.x + m_pntDownArrowOffset.x : m_LeftTopPoint.x + m_pntDownArrowOffset0.x;
rPos.top = m_bUpArrow ? m_LeftTopPoint.y + m_pntDownArrowOffset.y : m_LeftTopPoint.y + m_pntDownArrowOffset0.y;
rPos.right = rPos.left + m_pntUpDownArrowSize.x;
rPos.bottom = rPos.top + m_pntUpDownArrowSize.y;
m_pImgRender->CreateImage(BIType_square, m_sUpDownArrowTexture.c_str(), 0xFF808080, m_frDownArrowUV, rPos);
}
if (m_bLeftArrow)
{
rPos.left = m_LeftTopPoint.x + m_pntLeftArrowOffset.x;
rPos.top = m_LeftTopPoint.y + m_pntLeftArrowOffset.y;
rPos.right = rPos.left + m_pntLeftRightArrowSize.x;
rPos.bottom = rPos.top + m_pntLeftRightArrowSize.y;
m_pImgRender->CreateImage(BIType_square, m_sLeftRightArrowTexture.c_str(), 0xFF808080, m_frLeftArrowUV, rPos);
}
if (m_bRightArrow)
{
rPos.left = m_LeftTopPoint.x + m_pntRightArrowOffset.x;
rPos.top = m_LeftTopPoint.y + m_pntRightArrowOffset.y;
rPos.right = rPos.left + m_pntLeftRightArrowSize.x;
rPos.bottom = rPos.top + m_pntLeftRightArrowSize.y;
m_pImgRender->CreateImage(BIType_square, m_sLeftRightArrowTexture.c_str(), 0xFF808080, m_frRightArrowUV, rPos);
}
}

void BICommandList::SetNote(const char *pcNote, int32_t nX, int32_t nY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class BICommandList

virtual void Init();

int32_t AddToIconList(int32_t nTextureNum, int32_t nNormPictureNum, int32_t nSelPictureNum, int32_t nCooldownPictureNum,
int32_t nCharacterIndex, const char *pcCommandName, int32_t nTargetIndex, const char *pcLocName,
const char *pcNoteName);
int32_t AddToIconList(int32_t nTextureNum, int32_t nNormPictureNum, int32_t nSelPictureNum,
int32_t nCooldownPictureNum, int32_t nCharacterIndex, const char *pcCommandName,
int32_t nTargetIndex, const char *pcLocName, const char *pcNoteName);
void AddAdditiveToIconList(int32_t nTextureNum, int32_t nPictureNum, float fDist, float fWidth, float fHeight);

protected:
Expand Down Expand Up @@ -100,8 +100,6 @@ class BICommandList
int32_t m_nStartUsedCommandIndex;
int32_t m_nSelectedCommandIndex;
int32_t m_nIconShowMaxQuantity;
bool m_bLeftArrow;
bool m_bRightArrow;

IPOINT m_pntActiveIconOffset;
IPOINT m_pntActiveIconSize;
Expand All @@ -118,6 +116,16 @@ class BICommandList
IPOINT m_pntUpDownArrowSize;
IPOINT m_pntUpArrowOffset;
IPOINT m_pntDownArrowOffset;
IPOINT m_pntDownArrowOffset0;

bool m_bLeftArrow;
bool m_bRightArrow;
std::string m_sLeftRightArrowTexture;
FRECT m_frLeftArrowUV;
FRECT m_frRightArrowUV;
IPOINT m_pntLeftRightArrowSize;
IPOINT m_pntLeftArrowOffset;
IPOINT m_pntRightArrowOffset;

std::string m_sCurrentCommandName;
int32_t m_nCurrentCommandCharacterIndex;
Expand Down Expand Up @@ -146,7 +154,8 @@ class BICommandList
void Release();

int32_t IconAdd(int32_t nPictureNum, int32_t nTextureNum, RECT &rpos);
int32_t ClockIconAdd(int32_t nForePictureNum, int32_t nBackPictureNum, int32_t nTextureNum, RECT &rpos, float fFactor);
int32_t ClockIconAdd(int32_t nForePictureNum, int32_t nBackPictureNum, int32_t nTextureNum, RECT &rpos,
float fFactor);
void AdditiveIconAdd(float fX, float fY, std::vector<UsedCommand::AdditiveIcon> &aList);
FRECT &GetPictureUV(int32_t nTextureNum, int32_t nPictureNum, FRECT &uv);
RECT &GetCurrentPos(int32_t num, RECT &rpos) const;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/battle_interface/src/battle_sign.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "battle_sign.h"
#include "utils.h"
#include "bi_utils.h"
#include "controls.h"
#include "core.h"
#include "vma.hpp"
Expand Down
Loading