Skip to content
Permalink
Browse files

floating numbers and alt highlight work with zoom

  • Loading branch information...
qndel committed Sep 16, 2018
1 parent 2137ebd commit dbd7222ec68b0ec04c01b3334b2a123dd0dd685e
Showing with 80 additions and 56 deletions.
  1. BIN Infernity.zip
  2. +45 −43 Source/automap.cpp
  3. +8 −0 Source/diablo.cpp
  4. +2 −0 Source/engine.h
  5. +19 −8 Source/player.cpp
  6. +2 −2 ddraw_settings.ini
  7. +2 −1 lootFilter.lua
  8. +2 −2 structs.h
BIN -4.18 KB (100%) Infernity.zip
Binary file not shown.
@@ -57,10 +57,10 @@ void __cdecl InitAutomap()
signed int v15; // edx
int size; // [esp+Ch] [ebp-4h]

int old_320 = ScreenWidth / 2;
int old_32 = ScreenWidth / 20;
int old_50 = 50*640/ScreenWidth;
int old_5 = 5*640/ScreenWidth;
int old_320 = 320;// ScreenWidth / 2;
int old_32 = 32;// ScreenWidth / 20;
int old_50 = 50;// 50 * 640 / ScreenWidth;
int old_5 = 5;// 5 * 640 / ScreenWidth;

v0 = old_50;
v1 = 0;
@@ -322,6 +322,35 @@ int GetItemRarity(int index) {
return GetItemRarity(index, NULL, false);
}

POINT adjustCoordsToZoom(int x, int y) {
int targetHeight = GLOBAL_HEIGHT - GLOBAL_HEIGHT * globalScrollZoom / 200;
int targetWidth = GLOBAL_WIDTH - GLOBAL_WIDTH * globalScrollZoom / 200;
int widthDiff = GLOBAL_WIDTH - targetWidth;
int heightDiff = GLOBAL_HEIGHT - targetHeight;
int distToCenterX = abs(ScreenWidth / 2 - x);
int distToCenterY = abs(ScreenHeight / 2 - y);
if (x <= ScreenWidth / 2) {
x = ScreenWidth / 2 - distToCenterX - distToCenterX * (globalScrollZoom) / 100;
}
else {
x = ScreenWidth / 2 + distToCenterX + distToCenterX * (globalScrollZoom) / 100;
}

if (y <= ScreenHeight / 2) {
y = ScreenHeight / 2 - distToCenterY - distToCenterY * (globalScrollZoom) / 100;
}
else {
y = ScreenHeight / 2 + distToCenterY + distToCenterY * (globalScrollZoom) / 100;
}

POINT p;
p.x = x;
p.y = y;
return p;


}

void AddItemToDrawQueue(int x, int y, int id) {

if (lootFilterBroken == false) {
@@ -352,45 +381,11 @@ void AddItemToDrawQueue(int x, int y, int id) {
if (lfd.show == false) { return; }
int centerXOffset = GetTextWidth((char*)lfd.name.c_str()) ;

int targetHeight = GLOBAL_HEIGHT - GLOBAL_HEIGHT * globalScrollZoom / 200;
int targetWidth = GLOBAL_WIDTH - GLOBAL_WIDTH * globalScrollZoom / 200;
int widthDiff = GLOBAL_WIDTH - targetWidth;
int heightDiff = GLOBAL_HEIGHT - targetHeight;

//x += widthDiff/4;
//y += widthDiff/4;
std::stringstream ss;



int distToCenterX = abs(ScreenWidth/2-x);
int distToCenterY = abs(ScreenHeight / 2 - y);
if (x <= ScreenWidth / 2) {
x = ScreenWidth / 2 - distToCenterX - distToCenterX * (globalScrollZoom) / 100;
}
else {
x = ScreenWidth / 2 + distToCenterX + distToCenterX * (globalScrollZoom) / 100;
}

if (y <= ScreenHeight / 2) {
y = ScreenHeight / 2 - distToCenterY - distToCenterY * (globalScrollZoom) / 100;
}
else {
y = ScreenHeight / 2 + distToCenterY + distToCenterY * (globalScrollZoom) / 100;
}

x -= centerXOffset / 2 + 20;
y -= 193;




//ss << x << " " << y << " ";

//NetSendCmdString(1 << myplr, ss.str().c_str());
//x += x globalScrollZoom / 100;
//y += y * globalScrollZoom / 100;
drawQ.push_back(drawingQueue(x, y, GetTextWidth((char*)lfd.name.c_str()), 13, it->_ix, it->_iy, id, lfd.color2, lfd.name, 1, lfd.r, lfd.g,lfd.b));
POINT p = adjustCoordsToZoom(x, y);
x = p.x; y = p.y;
x -= centerXOffset / 2 + 20;
y -= 193;
drawQ.push_back(drawingQueue(x, y, GetTextWidth((char*)lfd.name.c_str()), 13, it->_ix, it->_iy, id, lfd.color2, lfd.name, 1, lfd.r, lfd.g,lfd.b));
}

void HighlightItemsNameOnMap()
@@ -1219,6 +1214,13 @@ void __cdecl DrawAutomapGame()
v0+=15;
}
PrintGameStr(8, v0, "INFERNITY", COL_RED);
v0 += 15;

int targetHeight = GLOBAL_HEIGHT - GLOBAL_HEIGHT * globalScrollZoom / 200;
int targetWidth = GLOBAL_WIDTH - GLOBAL_WIDTH * globalScrollZoom / 200;
std::stringstream res;
res << targetWidth << "x" << targetHeight;
PrintGameStr(8, v0, (char*)res.str().c_str(), COL_RED);
}
// 5CCB10: using guessed type char setlvlnum;
// 5CF31D: using guessed type char setlevel;
@@ -768,12 +768,20 @@ LRESULT __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if ((short)HIWORD(wParam) < 0)
{
if (globalScrollZoom > 0) {
int globalScrollZoom2 = globalScrollZoom - 5;
int targetHeight = GLOBAL_HEIGHT - GLOBAL_HEIGHT * globalScrollZoom2 / 200;
int targetWidth = GLOBAL_WIDTH - GLOBAL_WIDTH * globalScrollZoom2 / 200;
if (targetHeight < 480 || targetWidth < 640) { return 0; }
globalScrollZoom -= 5;
}
}
else
{
if (globalScrollZoom < 100) {
int globalScrollZoom2 = globalScrollZoom + 5;
int targetHeight = GLOBAL_HEIGHT - GLOBAL_HEIGHT * globalScrollZoom2 / 200;
int targetWidth = GLOBAL_WIDTH - GLOBAL_WIDTH * globalScrollZoom2 / 200;
if (targetHeight < 480 || targetWidth < 640) { return 0; }
globalScrollZoom += 5;
}
}
@@ -112,6 +112,8 @@ void setGameState(int state);
void fatalLua(const char* message);
void LuaInit();
void DrawGame(int StartX, int StartY, bool isTown);
POINT adjustCoordsToZoom(int x, int y);
void AddToFloatingQueue(FloatingText ft);

extern std::map<std::string, bool> BoolConfig;
extern std::map<std::string, int> IntConfig;
@@ -216,7 +216,7 @@ void DrawFloatingTextAbovePlayer() {

int walkStandX = ScrollInfo._sxoff;// +plr[myplr]._pyoff;
int walkStandY = ScrollInfo._syoff;// +plr[myplr]._pxoff;

if (plr[myplr]._pmode == PM_WALK2 && ScrollInfo._sdir == 4) {
walkStandX += 32;
walkStandY += 16;
@@ -245,18 +245,29 @@ void DrawFloatingTextAbovePlayer() {
int col = FloatingTextQueue[i].posY - plr[myplr].WorldY;
int PlayerShiftY = 0;
int PlayerShiftX = 0;
x = 32 * (row - col) + (200 * (walkStandX) / 100 >> 1) - GetTextWidth((char*)text.c_str()) / 2;
y = 16 * (row + col) + (200 * (walkStandY) / 100 >> 1) - 16;
//x = 32 * (row - col) + (200 * (walkStandX) / 100 >> 1);
//y = 16 * (row + col) + (200 * (walkStandY) / 100 >> 1) - 16;
//walkStandX * (200-globalScrollZoom) / 200
walkStandX += (walkStandX* globalScrollZoom ) / 100;
walkStandY += (walkStandY* globalScrollZoom) / 100;
x = 64 * (row - col) * (globalScrollZoom + 100) / 200 + walkStandX;
y = 32 * (row + col) * (globalScrollZoom + 100) / 200 + walkStandY - 16;


int drawXOffset = 0;
if (invflag || sbookflag)
drawXOffset -= 160;
if (chrflag || questlog)
drawXOffset += 160;
//if (invflag || sbookflag)
// drawXOffset -= 160;
//if (chrflag || questlog)
// drawXOffset += 160;
x = x + ScreenWidth / 2;// 320 + drawXOffset;
y = y + GetHeightDiff()/2;
}

//POINT p = adjustCoordsToZoom(x, y);
//x = p.x;
//y = p.y;
y += 100;
x -= GetTextWidth((char*)text.c_str()) / 2;
double PI = 3.14159265;
double DistanceToTravel = ScreenHeight * PercentOfTheScreenToTravel / 100;
//y = ax + b
@@ -273,7 +284,7 @@ void DrawFloatingTextAbovePlayer() {
int drawx = x - int(progress * diff_x);
int drawy = y - int(progress * diff_y);

if (drawx > 0 && drawy < ScreenWidth && drawy > minHeight && drawy < ScreenHeight) {
if (drawx > 0 && drawx < ScreenWidth && drawy > minHeight && drawy < ScreenHeight) {
char bfr[256];

//int callerID;
@@ -1,6 +1,6 @@
[video]
windowedResolution=1280x960
windowedResolution=1600x1200
fullscreenResolution=1280x960
refresh=60
fullscreen=0
vsync=1
vsync=0
@@ -261,7 +261,7 @@ function testLootFilter1(args)
end

function lootFilter(playerName,playerClass,itemName,itemType,itemSlot,itemRarity,itemColor)
local isGood,v1,v2,v3,v4,v5,v6 = pcall(lootFilterLowercase,{playerName=playerName:lower(),playerClass=playerClass,itemName=itemName:lower(),itemType=itemType,itemSlot=itemSlot,itemRarity=itemRarity,itemColor=itemColor})
local isGood,v1,v2,v3,v4,v5,v6 = pcall(lootFilterLowercase,{playerName=playerName:lower(),playerClass=playerClass,itemName=itemName:lower(),itemType=itemType,itemSlot=itemSlot,itemRarity=itemRarity,itemColor=itemColor})
if isGood == true then
if v1 ~= nil and v2 ~= nil and v3 ~= nil and v4 ~= nil and v5 ~= nil then
if type(v1) == "string" and type(v2) == "number" and type(v3) == "number" and type(v4) == "number" and type(v5) == "number" and type(v6) == "number" then
@@ -314,6 +314,7 @@ end



-- you can look what I've done in testLootFilter1 function and do stuff in yourLootFilter.

function yourLootFilter(args)
return args.itemName,1,args.itemColor,0,0,0
@@ -1,6 +1,6 @@
#include <string>
#define GLOBAL_WIDTH 1280
#define GLOBAL_HEIGHT 960
#define GLOBAL_WIDTH 640
#define GLOBAL_HEIGHT 480
#define MAX_STASH_TABS 100
#define MEGAPACKETSIZE 92000
class drawingQueue

0 comments on commit dbd7222

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