Skip to content

Commit

Permalink
Merge pull request #3 from GarAdminTools/races
Browse files Browse the repository at this point in the history
Updates 28, 29, 30
  • Loading branch information
GarAdminTools committed Feb 26, 2017
2 parents 35db18a + e2b7816 commit 800641f
Show file tree
Hide file tree
Showing 391 changed files with 23,804 additions and 1,439 deletions.
2 changes: 1 addition & 1 deletion clientd3d/client.h
Expand Up @@ -48,7 +48,7 @@ typedef unsigned char Bool;
enum {False = 0, True = 1};

#define MAJOR_REV 50 /* Major version of client program */
#define MINOR_REV 35 /* Minor version of client program; must be in [0, 99] */
#define MINOR_REV 36 /* Minor version of client program; must be in [0, 99] */

#define MAXAMOUNT 9 /* Max # of digits in a server integer */
#define MAXSTRINGLEN 512 /* Max length of a string loaded from string table */
Expand Down
2 changes: 1 addition & 1 deletion clientd3d/d3drender.c
Expand Up @@ -3962,7 +3962,7 @@ void D3DRenderNamesDraw3D(d3d_render_cache_system *pCacheSystem, d3d_render_pool
if (pRNode->obj.id == player.id)
continue;

if (!(pRNode->obj.flags & OF_PLAYER) || (pRNode->obj.drawingtype == DRAWFX_INVISIBLE))
if (!(pRNode->obj.flags & OF_DISPLAY_NAME) || (pRNode->obj.drawingtype == DRAWFX_INVISIBLE))
continue;

vector.x = pRNode->motion.x - player.x;
Expand Down
2 changes: 1 addition & 1 deletion clientd3d/lagbox.c
Expand Up @@ -110,7 +110,7 @@ BOOL Lagbox_Create()
pobjLagbox->normal_animate.group_low = 1;
pobjLagbox->normal_animate.group_high = 1;
pobjLagbox->drawingtype = DRAWFX_DITHERTRANS;
pobjLagbox->flags = OF_PLAYER;
pobjLagbox->flags = OF_PLAYER | OF_DISPLAY_NAME;
pobjLagbox->minimapflags = 0;
pobjLagbox->namecolor = NC_OUTLAW;
pobjLagbox->objecttype = OT_NONE;
Expand Down
154 changes: 55 additions & 99 deletions clientd3d/map.c
Expand Up @@ -38,6 +38,7 @@
#define MAP_TEMPSAFE_COLOR PALETTERGB(0,170,255) // Cyan
#define MAP_MINIBOSS_COLOR PALETTERGB(160, 66, 194) // Purple
#define MAP_BOSS_COLOR PALETTERGB(127, 0, 0) // Dark Red
#define MAP_RARE_ITEM_COLOR PALETTERGB(237, 255, 9) // Orange

#define MAP_OBJECT_RADIUS (FINENESS / 4) // Radius of circle drawn for an object

Expand All @@ -49,10 +50,10 @@
#define MAP_OBJECT_DISTANCE (7 * FINENESS) // Draw all object closer than this to player

static HBRUSH hObjectBrush, hPlayerBrush, hNullBrush, hMinionBrush,
hMinionOtherBrush, hNpcBrush, hTempsafeBrush;
hMinionOtherBrush, hNpcBrush, hTempsafeBrush, hItemBrush;
static HPEN hWallPen, hPlayerPen, hObjectPen, hMinionPen, hMinionOtherPen,
hMinibossPen, hBossPen;
static HPEN hFriendPen, hEnemyPen, hGuildmatePen, hBuilderPen, hNpcPen, hTempsafePen;
hMinibossPen, hBossPen, hItemPen, hFriendPen, hEnemyPen,
hGuildmatePen, hBuilderPen, hNpcPen, hTempsafePen;

static float zoom; // Factor to zoom in on map

Expand Down Expand Up @@ -89,6 +90,8 @@ static void MapDrawMiniMapWalls(HDC hdc, int x, int y, room_type *room);
static void MapDrawWall(HDC hdc, int x, int y, float scale, WallData *wall);
static void MapDrawPlayer(HDC hdc, int x, int y, float scale, int minimapflags);
static void MapDrawObjects(HDC hdc, list_type objects, int x, int y, float scale);
static inline void DrawMinimapDot(HDC hdc, HPEN pen, HBRUSH brush, float radius, float x, float y);
static void DrawMinimapStar(HDC hdc, HPEN pen, HBRUSH brush, float size, float x, float y);
static void MapDrawWalls(HDC hdc, int x, int y, float scale, room_type *room);
static void MapDrawAnnotations( HDC hdc, MapAnnotation *annotations, int x, int y, float scaleToUse, Bool bMiniMap );

Expand Down Expand Up @@ -148,13 +151,15 @@ void MapInitialize(void)
hTempsafePen = CreatePen(PS_SOLID, MAP_OBJECT_THICKNESS, MAP_TEMPSAFE_COLOR);
hMinibossPen = CreatePen(PS_SOLID, MAP_BOSS_THICKNESS, MAP_MINIBOSS_COLOR);
hBossPen = CreatePen(PS_SOLID, MAP_BOSS_THICKNESS, MAP_BOSS_COLOR);
hItemPen = CreatePen(PS_SOLID, MAP_OBJECT_THICKNESS, MAP_RARE_ITEM_COLOR);

hNpcBrush = CreateSolidBrush(MAP_NPC_COLOR);
hMinionOtherBrush = CreateSolidBrush(MAP_MINION_OTH_COLOR);
hMinionBrush = CreateSolidBrush(MAP_MINION_COLOR);
hObjectBrush = CreateSolidBrush(MAP_OBJECT_COLOR);
hPlayerBrush = CreateSolidBrush(MAP_PLAYER_COLOR);
hTempsafeBrush = CreateSolidBrush(MAP_TEMPSAFE_COLOR);
hItemBrush = CreateSolidBrush(MAP_RARE_ITEM_COLOR);
hNullBrush = CreateBrushIndirect(&logBrush);

zoom = (float) 1.0;
Expand Down Expand Up @@ -191,13 +196,15 @@ void MapClose(void)
DeleteObject(hTempsafePen);
DeleteObject(hMinibossPen);
DeleteObject(hBossPen);
DeleteObject(hItemPen);
DeleteObject(hMinionOtherBrush);
DeleteObject(hMinionBrush);
DeleteObject(hObjectBrush);
DeleteObject(hPlayerBrush);
DeleteObject(hNullBrush);
DeleteObject(hNpcBrush);
DeleteObject(hTempsafeBrush);
DeleteObject(hItemBrush);

if (pMapWalls)
SafeFree(pMapWalls);
Expand Down Expand Up @@ -408,139 +415,88 @@ void MapDrawObjects(HDC hdc, list_type objects, int x, int y, float scale)
// Draw NPC dots no matter where they are.
dx = (r->motion.x - player.x) >> 4;
dy = (r->motion.y - player.y) >> 4;
if (((dx * dx + dy * dy) > mapObjectDistanceShiftAndSquare) &&
(!r->visible && !config.showUnseenMonsters) &&
!(r->obj.flags & OF_PLAYER) && !(r->obj.minimapflags & MM_NPC) &&
!(r->obj.minimapflags & MM_MINIBOSS) && !(r->obj.minimapflags & MM_BOSS))
if (((dx * dx + dy * dy) > mapObjectDistanceShiftAndSquare)
&& (!r->visible && !config.showUnseenMonsters)
&& (r->obj.flags & MM_MONSTER))
continue;

new_x = x + (r->motion.x * scale);
new_y = y + (r->motion.y * scale);
float ring_radius;

// Draw rings around players
if (r->obj.flags & OF_PLAYER)
{
SelectObject(hdc, hPlayerBrush);

// Builder group?
if (r->obj.minimapflags & MM_BUILDER_GROUP)
{
ring_radius = 2.6f * radius;
SelectObject(hdc, hBuilderPen);
Ellipse(hdc, (int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
}

ring_radius = 1.6f * radius;
DrawMinimapDot(hdc, hBuilderPen, hPlayerBrush, 2.6f * radius, new_x, new_y);
// Friend?
if (r->obj.minimapflags & MM_FRIEND)
{
SelectObject(hdc, hFriendPen);
Ellipse(hdc, (int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
}

DrawMinimapDot(hdc, hFriendPen, hPlayerBrush, 1.6f * radius, new_x, new_y);
// Enemy?
if (r->obj.minimapflags & MM_ENEMY)
{
SelectObject(hdc, hEnemyPen);
Ellipse(hdc, (int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
}

DrawMinimapDot(hdc, hEnemyPen, hPlayerBrush, 1.6f * radius, new_x, new_y);
// Guildmate?
if (r->obj.minimapflags & MM_GUILDMATE)
{
SelectObject(hdc, hGuildmatePen);
Ellipse(hdc, (int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
}
DrawMinimapDot(hdc, hGuildmatePen, hPlayerBrush, 1.6f * radius, new_x, new_y);
}

/* Draw middle of player dot in a different color. If a monster
is a minion or NPC then color it appropriately, otherwise it
gets the standard red dot. */
if (r->obj.minimapflags & MM_PLAYER)
{
SelectObject(hdc, hPlayerPen);
SelectObject(hdc, hPlayerBrush);
}
DrawMinimapDot(hdc, hPlayerPen, hPlayerBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_TEMPSAFE)
{
SelectObject(hdc, hTempsafePen);
SelectObject(hdc, hTempsafeBrush);
}
DrawMinimapDot(hdc, hTempsafePen, hTempsafeBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_MINION_SELF)
{
SelectObject(hdc, hMinionPen);
SelectObject(hdc, hMinionBrush);
}
DrawMinimapDot(hdc, hMinionPen, hMinionBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_MINION_OTHER)
{
SelectObject(hdc, hMinionOtherPen);
SelectObject(hdc, hMinionOtherBrush);
}
DrawMinimapDot(hdc, hMinionOtherPen, hMinionOtherBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_MONSTER)
{
SelectObject(hdc, hObjectPen);
SelectObject(hdc, hObjectBrush);
}
DrawMinimapDot(hdc, hObjectPen, hObjectBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_NPC)
{
SelectObject(hdc, hNpcPen);
SelectObject(hdc, hNpcBrush);
}
DrawMinimapDot(hdc, hNpcPen, hNpcBrush, radius, new_x, new_y);
else if (r->obj.minimapflags & MM_RARE_ITEM)
DrawMinimapStar(hdc, hItemPen, hItemBrush, radius * 3.0f, new_x, new_y);
else if (r->obj.minimapflags & MM_MINIBOSS)
{
SelectObject(hdc, hObjectBrush);
SelectObject(hdc, hMinibossPen);
ring_radius = 2.1f * radius;
Ellipse(hdc,(int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
SelectObject(hdc, hObjectPen);
Ellipse(hdc,(int) (new_x - radius * 1.2f), (int) (new_y - radius * 1.2f),
(int) (new_x + radius * 1.2f), (int) (new_y + radius * 1.2f));

continue;
DrawMinimapDot(hdc, hMinibossPen, hObjectBrush, radius * 2.1f, new_x, new_y);
DrawMinimapDot(hdc, hObjectPen, hObjectBrush, radius * 1.2f, new_x, new_y);
}
else if (r->obj.minimapflags & MM_BOSS)
{
SelectObject(hdc, hObjectBrush);
SelectObject(hdc, hBossPen);
ring_radius = 2.6f * radius;
Ellipse(hdc,(int) (new_x - ring_radius),
(int) (new_y - ring_radius),
(int) (new_x + ring_radius),
(int) (new_y + ring_radius));
SelectObject(hdc, hObjectPen);
Ellipse(hdc,(int) (new_x - radius * 1.6f), (int) (new_y - radius * 1.6f),
(int) (new_x + radius * 1.6f), (int) (new_y + radius * 1.6f));

continue;
}
else
{
// No dots for anything else, yet.
continue;
DrawMinimapDot(hdc, hBossPen, hObjectBrush, radius * 2.6f, new_x, new_y);
DrawMinimapDot(hdc, hObjectPen, hObjectBrush, radius * 1.6f, new_x, new_y);
}
}
}

// Draw a circle at the object's position
Ellipse(hdc, (int) (new_x - radius), (int) (new_y - radius),
(int) (new_x + radius), (int) (new_y + radius));
static inline void DrawMinimapDot(HDC hdc, HPEN pen, HBRUSH brush, float radius, float x, float y)
{
SelectObject(hdc, pen);
SelectObject(hdc, brush);
Ellipse(hdc, (int)(x - radius), (int)(y - radius), (int)(x + radius), (int)(y + radius));
}

static void DrawMinimapStar(HDC hdc, HPEN pen, HBRUSH brush, float size, float x, float y)
{
float alpha = PITWICE / 10;
POINT p[11];

SelectObject(hdc, pen);
SelectObject(hdc, brush);

// Build points
for (int i = 0; i < 11; ++i)
{
float r = size * (i % 2 + 1) / 2.0f;
float omega = alpha * i;
p[i].x = (LONG)((r * sin(omega)) + x);
p[i].y = (LONG)((r * cos(omega)) + y);
}

Polygon(hdc, p, 11);
}

/*****************************************************************************/
/*
* MapDrawPlayer: Draw a line on the map indicating the player's position.
Expand Down
2 changes: 1 addition & 1 deletion clientd3d/object3d.c
Expand Up @@ -872,7 +872,7 @@ void DrawObjectDecorations(DrawnObject *object)
if (r == NULL)
return;

if (!(r->obj.flags & OF_PLAYER) || (r->obj.drawingtype == DRAWFX_INVISIBLE))
if (!(r->obj.flags & OF_DISPLAY_NAME) || (r->obj.drawingtype == DRAWFX_INVISIBLE))
return;

// Draw player name
Expand Down
2 changes: 2 additions & 0 deletions include/proto.h
Expand Up @@ -365,6 +365,7 @@ enum {


/* Object flag values and masks */
#define OF_DISPLAY_NAME 0x00000001 // Set if object should have name displayed
#define OF_PLAYER 0x00000004 // Set if object is a player
#define OF_ATTACKABLE 0x00000008 // Set if object is legal target for an attack
#define OF_GETTABLE 0x00000010 // Set if player can try to pick up object
Expand Down Expand Up @@ -415,6 +416,7 @@ enum {
#define MM_TEMPSAFE 0x00000200 // Set if player has a temporary angel.
#define MM_MINIBOSS 0x00000400 // Set if mob is a miniboss (survival arena).
#define MM_BOSS 0x00000800 // Set if mob is a boss (survival arena).
#define MM_RARE_ITEM 0x00001000 // Set if item is rare.

/* Player name color sent as hex RGB value. Define constants
for ease of use as needed. Requires OF_PLAYER boolean flag
Expand Down

0 comments on commit 800641f

Please sign in to comment.