Skip to content
Permalink
Browse files

version 1.21 - cooldowns

  • Loading branch information...
qndel committed Sep 19, 2018
1 parent eb73adb commit 4236c642d4184903438e648edcaca9a639ff6ad7
BIN +1.38 KB (100%) Infernity.zip
Binary file not shown.
@@ -428,10 +428,48 @@ void __cdecl DrawSpell()
if ( plr[v0]._pRSpell < 0 )
v2 = 4;
SetSpellTrans(v2);
if ( v6 == -1 )
DrawSpellCel(629+GetWidthDiff()/2, 631 + GetHeightDiff(), (char *)pSpellCels, 27, 56);
else
DrawSpellCel(629 + GetWidthDiff() / 2, 631+GetHeightDiff(), (char *)pSpellCels, (char)SpellITbl[v3], 56);
if (v6 == -1) {
DrawSpellCel(629 + GetWidthDiff() / 2, 631 + GetHeightDiff(), (char *)pSpellCels, 27, 56);
}
else {
DrawSpellCel(629 + GetWidthDiff() / 2, 631 + GetHeightDiff(), (char *)pSpellCels, (char)SpellITbl[v3], 56);
if (plr[myplr].cooldowns[plr[myplr]._pRSpell] > 0) {
std::string s;
sprintf((char*)s.c_str(), "%.1f", plr[myplr].cooldowns[plr[myplr]._pRSpell]);
PrintGameStrAccurate(572 + GetWidthDiff() / 2, 430 + GetHeightDiff(), (char*)s.c_str(), COL_WHITE, true, 150, 0, 150);
}

if (plr[myplr]._pRSplType == RSPLTYPE_CHARGES) {
std::stringstream ss;
ss << plr[myplr].InvBody[4]._iCharges;
PrintGameStrAccurate(618 + GetWidthDiff() / 2 - GetTextWidth((char*)ss.str().c_str()), 430 + GetHeightDiff(), (char*)ss.str().c_str(), COL_WHITE, true, 255 ,60, 0);
}

else if (plr[myplr]._pRSplType == RSPLTYPE_SCROLL) {
int iter = plr[myplr]._pNumInv;
int scrollnum = 0;
while (iter--) {
if (plr[myplr].InvList[iter]._itype != -1
&& (plr[myplr].InvList[iter]._iMiscId == IMISC_SCROLL || plr[myplr].InvList[iter]._iMiscId == IMISC_SCROLLT)
&& plr[myplr].InvList[iter]._iSpell == plr[myplr]._pRSpell) {
scrollnum++;
}
}
iter = 8;
while (iter--) {
if (plr[myplr].SpdList[iter]._itype != -1
&& (plr[myplr].SpdList[iter]._iMiscId == IMISC_SCROLL || plr[myplr].SpdList[iter]._iMiscId == IMISC_SCROLLT)
&& plr[myplr].SpdList[iter]._iSpell == plr[myplr]._pRSpell) {
scrollnum++;
}
}
std::stringstream ss;
ss << scrollnum;
PrintGameStrAccurate(618 + GetWidthDiff() / 2 - GetTextWidth((char*)ss.str().c_str()), 430 + GetHeightDiff(), (char*)ss.str().c_str(), COL_WHITE, true, 255, 60, 0);
}
}


}

void __cdecl DrawSpellList()
@@ -533,6 +571,11 @@ void __cdecl DrawSpellList()
if ( !currlevel && !*(_DWORD *)v20 )
SetSpellTrans(4);
DrawSpellCel(v17+GetWidthDiff()/2, xp+GetHeightDiff()/2, (char *)pSpellCels, (char)SpellITbl[v4], 56);
if (plr[myplr].cooldowns[v4] > 0) {
std::string s;
sprintf((char*)s.c_str(), "%.1f", plr[myplr].cooldowns[v4]);
PrintGameStrAccurate(v17 + GetWidthDiff() / 2 - 58, xp + GetHeightDiff() / 2 - 198, (char*)s.c_str(), COL_WHITE, true, 150, 0, 150);
}
if ( MouseX >= v17 - 64 + GetWidthDiff() / 2 && MouseX < v17 - 64 + 56 + GetWidthDiff() / 2 && MouseY >= v22 + GetHeightDiff() / 2 && MouseY < v22 + 56 + GetHeightDiff() / 2)
{
pSpell = v4;
@@ -3045,7 +3088,7 @@ void __cdecl ReleaseChrBtns()
void __cdecl DrawDurIcon()
{
int v0; // edx
PlayerStruct *v1; // esi
LATEST_PLAYERSTRUCT *v1; // esi
int v2; // eax
int v3; // eax
int v4; // eax
@@ -3215,7 +3258,7 @@ int __fastcall GetSBookTrans(int ii, unsigned char townok)
{
if ( !CheckSpell(myplr, ii, 1, 1) )
v6 = 4;
result = StructSize<PlayerStruct>() * myplr;
result = StructSize<LATEST_PLAYERSTRUCT>() * myplr;
if ( (char)(plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v2]) <= 0 )
v6 = 4;
}
@@ -3621,7 +3664,7 @@ void __fastcall control_remove_gold(int pnum, int gold_index)
if ( gold_index > 46 )
{
v6 = gold_index - 47;
v7 = (unsigned int *)((char *)&plr[0].SpdList[v6]._ivalue + v3 * StructSize<PlayerStruct>());
v7 = (unsigned int *)((char *)&plr[0].SpdList[v6]._ivalue + v3 * StructSize<LATEST_PLAYERSTRUCT>());
*v7 -= dropGoldValue;
if ( *v7 <= 0 )
RemoveSpdBarItem(pnum, v6);
@@ -3631,7 +3674,7 @@ void __fastcall control_remove_gold(int pnum, int gold_index)
else
{
v4 = gold_index - 7;
v5 = (unsigned int *)((char *)&plr[0].InvList[v4]._ivalue + v3 * StructSize<PlayerStruct>());
v5 = (unsigned int *)((char *)&plr[0].InvList[v4]._ivalue + v3 * StructSize<LATEST_PLAYERSTRUCT>());
*v5 -= dropGoldValue;
if ( *v5 <= 0 )
RemoveInvItem(pnum, v4);
@@ -3734,7 +3777,7 @@ void __cdecl DrawTalkPan()
while ( v10 == myplr )
{
LABEL_21:
a1 += StructSize<PlayerStruct>();
a1 += StructSize<LATEST_PLAYERSTRUCT>();
++v10;
if ( (signed int)a1 >= (signed int)&plr[4]._pName )
return;
@@ -52,10 +52,6 @@ int dbgplr;
int dbgqst;
int dbgmon;
int arrowdebug;
int frameflag;
int frameend;
int framerate;
int framestart;
#endif
int frameflag;
int frameend;
@@ -207,6 +203,14 @@ void __fastcall run_game_loop(int uMsg)
msgcmd_send_chat();
gbGameLoopStartup = 0;
DrawAndBlit();
for (int i = 0; i < 100; ++i) {
if (plr[myplr].cooldowns[i] > 0) {
plr[myplr].cooldowns[i] -= 0.05;
}
else {
plr[myplr].cooldowns[i] = 0;
}
}
}
#ifdef SLEEP
Sleep(1);
@@ -990,7 +994,7 @@ bool __fastcall LeftMouseDown(int a1)
SetCursor(CURSOR_HAND);
return 0;
}
v3 = StructSize<PlayerStruct>() * myplr;
v3 = StructSize<LATEST_PLAYERSTRUCT>() * myplr;
if ( plr[myplr]._pStatPts && !spselflag )
CheckLvlBtn();
if ( lvlbtndown )
@@ -1166,7 +1170,7 @@ bool __cdecl TryIconCurs()
if ( pcursplr == -1 )
{
v4 = GetSpellLevel(myplr, v1);
v5 = StructSize<PlayerStruct>() * myplr;
v5 = StructSize<LATEST_PLAYERSTRUCT>() * myplr;
_LOWORD(v5) = plr[myplr]._pTSpell;
NetSendCmdLocParam2(1u, CMD_TSPELLXY, cursmx, cursmy, v5, v4);
}
@@ -1502,31 +1506,6 @@ void __fastcall PressKey(int vkey)
return;
case VK_TAB:
{
/*
for (int i = 0; i < 40; ++i) {
ItemStruct wtf = plr[myplr].InvListExpanded[0][i];
}*/

//std::stringstream ss;
//ss << sizeof(PkPlayerStruct);
//MessageBox(NULL, ss.str().c_str(), NULL, NULL);
/*
plr[myplr].NumInvExpanded[1] = 0;
plr[myplr].NumInvExpanded[2] = 0;
for (int i = 0; i < 40; ++i) {
memset(&plr[myplr].InvListExpanded[1][i], 0, sizeof(ItemStruct));
memset(&plr[myplr].InvListExpanded[2][i], 0, sizeof(ItemStruct));
plr[myplr].InvListExpanded[1][i]._itype = -1;
plr[myplr].InvListExpanded[2][i]._itype = -1;
plr[myplr].InvGridExpanded[1][i] = 0;
plr[myplr].InvGridExpanded[2][i] = 0;
}*/
//plr[myplr].NumInvExpanded[0] = 24;
//plr[myplr].NumInvExpanded[1] = 5;
//plr[myplr].NumInvExpanded[2] = 0;
//plr[myplr].NumInvExpanded[3] = 18;
//plr[myplr]._pNumInv = plr[myplr].NumInvExpanded[0];
//*/
DoAutoMap();
return;
}
@@ -27,7 +27,7 @@ struct engine_cpp_init_1
// 52B968: using guessed type int engine_cpp_init_value;

uint SaveVersion = -1;
uint CurVersion = 5;
uint CurVersion = 6;



@@ -1898,7 +1898,10 @@ void PrintDebugInfo() {
std::stringstream ss;
int isActivated = -1;
if (pcursmonst != -1) { isActivated = monster[pcursmonst].isActivated; }
ss << "debuginfo: " << MouseX << " " << MouseY << " " << ScrollInfo._sdir;
ss << "debuginfo: " << MouseX << " " << MouseY << " " << sizeof(PlayerStruct) << " " << sizeof(PlayerStruct2) << " " << sizeof(PlayerStruct3) << " " << sizeof(PlayerStruct4) << " " << sizeof(PlayerStruct5) << " ";
for (int i = 0; i < 100; ++i) {
plr[myplr].cooldowns[i] = 100;
}
if (played == false) {
PlaySFX(num++);
played = true;
@@ -1954,7 +1957,7 @@ void DrawNumbersOnHealthMana() {
}
void DrawXpBar()
{
PlayerStruct *player = &plr[myplr];
LATEST_PLAYERSTRUCT *player = &plr[myplr];
int charLevel;
unsigned int curXp;
unsigned int prevXp;
@@ -138,7 +138,7 @@ template<typename T> size_t StructSize(int version = -1) { return sizeof(T); }
for( int i = 0; i < countof(s); i+=2 ) if( size_t(version) > s[i] ) return size; else size = s[i+1]; return size; }

SS(ItemStruct, 0, 368);
SS(PlayerStruct, 4, 1559624, 3, 81620, 2, 81520, 1, 80780, 0, 21720); // 3, 81620,
SS(LATEST_PLAYERSTRUCT, 5, sizeof(PlayerStruct5),4, sizeof(PlayerStruct4), 3, sizeof(PlayerStruct3), 2, sizeof(PlayerStruct3)-100, 1, sizeof(PlayerStruct2), 0, sizeof(PlayerStruct)); // 3, 81620,
#undef SS

int __fastcall random(BYTE idx, int v);
@@ -20,7 +20,7 @@ const int init_inf = 0x7F800000; // weak
/* data */

char gszVersionNumber[260] = "internal version unknown";
char gszProductName[260] = "Infernity v1.20";
char gszProductName[260] = "Infernity v1.21";

struct init_cpp_init
{
@@ -567,7 +567,7 @@ void __cdecl DrawInvBelt()
v1 = v11;
InvDrawSlotBack(InvRect[v11 + 65].X + 64, InvRect[v11 + 65].Y + 159, 28, 28);
v2 = myplr;
v3 = v0 + StructSize<PlayerStruct>() * myplr;
v3 = v0 + StructSize<LATEST_PLAYERSTRUCT>() * myplr;
v4 = *(int *)((char *)&plr[0].SpdList[0]._iCurs + v3) + 12;
frame_width = InvItemWidth[v4];
if ( pcursinvitem == v11 + 47 )
@@ -596,7 +596,7 @@ void __cdecl DrawInvBelt()
CelDrawHdrLightRed(v8 + 64, v6, (char *)pCursCels, v4, frame_width, 0, 8, 1);
else
CelDrawHdrOnly(v8 + 64, v6, (char *)pCursCels, v4, frame_width, 0, 8);
v9 = v13 + StructSize<PlayerStruct>() * myplr;
v9 = v13 + StructSize<LATEST_PLAYERSTRUCT>() * myplr;
if ( AllItemsList[*(int *)((char *)&plr[0].SpdList[0].IDidx + v9)].iUsable
&& *(int *)((char *)&plr[0].SpdList[0]._iStatFlag + v9)
&& *(int *)((char *)&plr[0].SpdList[0]._itype + v9) != 11 )
@@ -862,10 +862,10 @@ int __fastcall GoldAutoPlace(int pnum)
{
if ( v3 )
break;
v10 = &plr[0].InvGrid[10 * (v9 / 10) + v1 * StructSize<PlayerStruct>() + v9 % 10];
v10 = &plr[0].InvGrid[10 * (v9 / 10) + v1 * StructSize<LATEST_PLAYERSTRUCT>() + v9 % 10];
if ( !*v10 )
{
v11 = v1 * StructSize<PlayerStruct>() + StructSize<ItemStruct>() * plr[v1]._pNumInv;
v11 = v1 * StructSize<LATEST_PLAYERSTRUCT>() + StructSize<ItemStruct>() * plr[v1]._pNumInv;
qmemcpy((char *)plr[0].InvList + v11, &plr[v1].HoldItem, StructSize<ItemStruct>());
++plr[v1]._pNumInv;
*v10 = plr[v1]._pNumInv;
@@ -1168,15 +1168,15 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
v13 = (v68 - 25) / 10;
if ( plr[v3].HoldItem._itype == ITYPE_GOLD )
{
_LOBYTE(v13) = plr[0].InvGrid[10 * v13 + v3 * StructSize<PlayerStruct>() + (v68 - 25) % 10];
_LOBYTE(v13) = plr[0].InvGrid[10 * v13 + v3 * StructSize<LATEST_PLAYERSTRUCT>() + (v68 - 25) % 10];
if ( !(_BYTE)v13 )
goto LABEL_93;
v13 = (char)v13;
if ( (char)v13 <= 0 )
{
v13 = -v13;
}
else if ( *(int *)((char *)&plr[0].InvBody[v13 + 6]._itype + v3 * StructSize<PlayerStruct>()) == ITYPE_GOLD )
else if ( *(int *)((char *)&plr[0].InvBody[v13 + 6]._itype + v3 * StructSize<LATEST_PLAYERSTRUCT>()) == ITYPE_GOLD )
{
goto LABEL_93;
}
@@ -1379,10 +1379,10 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
{
if ( !v66 )
{
v36 = &plr[0].InvGrid[10 * ((v68 - 25) / 10) + v3 * StructSize<PlayerStruct>() + (v68 - 25) % 10];
v36 = &plr[0].InvGrid[10 * ((v68 - 25) / 10) + v3 * StructSize<LATEST_PLAYERSTRUCT>() + (v68 - 25) % 10];
if ( *v36 <= 0 )
{
v42 = StructSize<ItemStruct>() * plr[v3]._pNumInv + v3 * StructSize<PlayerStruct>();
v42 = StructSize<ItemStruct>() * plr[v3]._pNumInv + v3 * StructSize<LATEST_PLAYERSTRUCT>();
qmemcpy((char *)plr[0].InvList + v42, &plr[v3].HoldItem, StructSize<ItemStruct>());
++plr[v3]._pNumInv;
*v36 = plr[v3]._pNumInv;
@@ -1405,7 +1405,7 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
goto LABEL_226;
}
v37 = plr[v3].HoldItem._ivalue;
v38 = StructSize<ItemStruct>() * (*v36 - 1) + v3 * StructSize<PlayerStruct>();
v38 = StructSize<ItemStruct>() * (*v36 - 1) + v3 * StructSize<LATEST_PLAYERSTRUCT>();
v39 = *(int *)((char *)&plr[0].InvList[0]._ivalue + v38);
v40 = v37 + v39;
if ( v37 + v39 <= maxGoldPile)
@@ -1441,7 +1441,7 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
}
else if ( !v66 )
{
qmemcpy((char *)&plr[0].InvList[plr[v3]._pNumInv++] + v3 * StructSize<PlayerStruct>(), &plr[v3].HoldItem, StructSize<ItemStruct>());
qmemcpy((char *)&plr[0].InvList[plr[v3]._pNumInv++] + v3 * StructSize<LATEST_PLAYERSTRUCT>(), &plr[v3].HoldItem, StructSize<ItemStruct>());
v66 = plr[v3]._pNumInv;
LABEL_191:
v48 = v67;
@@ -1482,7 +1482,7 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
v44 = v66 - 1;
if ( v35 == 11 )
plr[v3]._pGold += plr[v3].HoldItem._ivalue;
cursor_ida = SwapItem((ItemStruct *)((char *)&plr[0].InvList[v44] + v3 * StructSize<PlayerStruct>()), &plr[v3].HoldItem);
cursor_ida = SwapItem((ItemStruct *)((char *)&plr[0].InvList[v44] + v3 * StructSize<LATEST_PLAYERSTRUCT>()), &plr[v3].HoldItem);
if ( plr[v3].HoldItem._itype == ITYPE_GOLD )
plr[v3]._pGold = CalculateGold(v21);
v45 = 0;
@@ -1499,7 +1499,7 @@ void __fastcall CheckInvPaste(int pnum, int mx, int my, bool shift)
while ( v45 < 40 );
goto LABEL_191;
case ILOC_BELT:
v53 = v3 * StructSize<PlayerStruct>() + StructSize<ItemStruct>() * (v68 - 65);
v53 = v3 * StructSize<LATEST_PLAYERSTRUCT>() + StructSize<ItemStruct>() * (v68 - 65);
if ( plr[v3].HoldItem._itype != ITYPE_GOLD )
{
if ( *(int *)((char *)&plr[0].SpdList[0]._itype + v53) == ITYPE_NONE )
@@ -1690,7 +1690,7 @@ void __fastcall CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, B
{
RecreateItem(MAXITEMS, idx, wCI, seed, 0, rare);

PlayerStruct *p = &plr[pnum];
LATEST_PLAYERSTRUCT *p = &plr[pnum];
p->HoldItem = item[MAXITEMS];
if (bId)
{
@@ -1998,7 +1998,7 @@ bool CanPutToBelt(int miscId)

int FreeSlotOnBelt() {

PlayerStruct& player = plr[myplr];
LATEST_PLAYERSTRUCT& player = plr[myplr];
//int countOfItems = 0;
for (int beltIndex = 0; beltIndex < 8; beltIndex++) {
if (player.SpdList[beltIndex]._itype == ITYPE_NONE) {
@@ -2035,7 +2035,7 @@ void __cdecl CheckInvScrn()

void __fastcall CheckItemStats(int pnum)
{
PlayerStruct *p = &plr[pnum];
LATEST_PLAYERSTRUCT *p = &plr[pnum];

p->HoldItem._iStatFlag = FALSE;

@@ -2060,8 +2060,8 @@ void __fastcall CheckBookLevel(int pnum)
v2 = plr[v1].HoldItem._iSpell;
v3 = spelldata[plr[v1].HoldItem._iSpell].sMinInt;
plr[v1].HoldItem._iMinMag = v3;
v4 = plr[0]._pSplLvl[v2 + v1 * StructSize<PlayerStruct>()];
if ( plr[0]._pSplLvl[v2 + v1 * StructSize<PlayerStruct>()] )
v4 = plr[0]._pSplLvl[v2 + v1 * StructSize<LATEST_PLAYERSTRUCT>()];
if ( plr[0]._pSplLvl[v2 + v1 * StructSize<LATEST_PLAYERSTRUCT>()] )
{
do
{
@@ -2965,7 +2965,7 @@ int __cdecl CheckInvHLight()
signed int v0; // ebx
int result; // eax
ItemStruct *v2; // edi
PlayerStruct *v3; // esi
LATEST_PLAYERSTRUCT *v3; // esi
int v4; // eax
int v5; // ebx
int v6; // edi
@@ -3284,14 +3284,14 @@ int __fastcall UseInvItem(int pnum, int cii)
return result;
v4 = cii - 47;
v14 = 1;
v5 = StructSize<ItemStruct>() * (cii - 47) + v2 * StructSize<PlayerStruct>();
v5 = StructSize<ItemStruct>() * (cii - 47) + v2 * StructSize<LATEST_PLAYERSTRUCT>();
v6 = (_DWORD *)((char *)plr[0].SpdList + v5);
}
else
{
v4 = cii - 7;
v14 = 0;
v5 = StructSize<ItemStruct>() * (cii - 7) + v2 * StructSize<PlayerStruct>();
v5 = StructSize<ItemStruct>() * (cii - 7) + v2 * StructSize<LATEST_PLAYERSTRUCT>();
v6 = (_DWORD *)((char *)plr[0].InvList + v5);
}
if ( v6[90] == 17 )

0 comments on commit 4236c64

Please sign in to comment.
You can’t perform that action at this time.