parent
92b54b6f55
commit
e8448cddb9
@ -1,9 +1,10 @@
|
|||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
||||||
Color Color::white(0xFF, 0xFF, 0xFF, 0xFF);
|
Color Color::white (0xFF, 0xFF, 0xFF, 0xFF);
|
||||||
Color Color::black(0x00, 0x00, 0x00, 0xFF);
|
Color Color::black (0x00, 0x00, 0x00, 0xFF);
|
||||||
Color Color::alpha(0x00, 0x00, 0x00, 0x00);
|
Color Color::alpha (0x00, 0x00, 0x00, 0x00);
|
||||||
Color Color::red (0xFF, 0x00, 0x00, 0xFF);
|
Color Color::red (0xFF, 0x00, 0x00, 0xFF);
|
||||||
Color Color::green(0x00, 0xFF, 0x00, 0xFF);
|
Color Color::green (0x00, 0xFF, 0x00, 0xFF);
|
||||||
Color Color::blue (0x00, 0x00, 0xFF, 0xFF);
|
Color Color::blue (0x00, 0x00, 0xFF, 0xFF);
|
||||||
Color Color::pink (0xFF, 0x00, 0xFF, 0xFF);
|
Color Color::pink (0xFF, 0x00, 0xFF, 0xFF);
|
||||||
|
Color Color::yellow (0x00, 0xFF, 0xFF, 0xFF);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
Game g_game;
|
Game g_game;
|
||||||
|
|
||||||
|
Game::Game()
|
||||||
|
{
|
||||||
|
m_online = false;
|
||||||
|
}
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
#ifndef PLAYER_H
|
#ifndef PLAYER_H
|
||||||
#define PLAYER_H
|
#define PLAYER_H
|
||||||
|
|
||||||
#include "position.h"
|
#include "creature.h"
|
||||||
|
|
||||||
class Player
|
class Player : public Creature
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void setDrawSpeed(uint16 drawSpeed) { m_drawSpeed = drawSpeed; }
|
||||||
|
uint16 getDrawSpeed() { return m_drawSpeed; }
|
||||||
|
|
||||||
void setPosition(const Position& position) { m_position = position; }
|
void setCanReportBugs(uint8 canReportBugs) { m_canReportBugs = (canReportBugs != 0); }
|
||||||
Position *getPosition() { return &m_position; }
|
bool getCanReportBugs() { return m_canReportBugs; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Position m_position;
|
|
||||||
|
uint16 m_drawSpeed;
|
||||||
|
bool m_canReportBugs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,83 @@
|
|||||||
#include "thing.h"
|
#include "thing.h"
|
||||||
|
#include "tibiaspr.h"
|
||||||
|
#include <graphics/graphics.h>
|
||||||
|
|
||||||
|
ThingAttributes::ThingAttributes()
|
||||||
|
{
|
||||||
|
group = THING_GROUP_NONE;
|
||||||
|
blockSolid = false;
|
||||||
|
hasHeight = false;
|
||||||
|
blockPathFind = false;
|
||||||
|
blockProjectile = false;
|
||||||
|
alwaysOnTop = false;
|
||||||
|
alwaysOnTopOrder = 0;
|
||||||
|
stackable = false;
|
||||||
|
useable = false;
|
||||||
|
moveable = true;
|
||||||
|
pickupable = false;
|
||||||
|
rotable = false;
|
||||||
|
readable = false;
|
||||||
|
lookThrough = false;
|
||||||
|
speed = 0;
|
||||||
|
lightLevel = 0;
|
||||||
|
lightColor = 0;
|
||||||
|
isVertical = false;
|
||||||
|
isHorizontal = false;
|
||||||
|
isHangable = false;
|
||||||
|
miniMapColor = 0;
|
||||||
|
hasMiniMapColor = false;
|
||||||
|
subParam07 = 0;
|
||||||
|
subParam08 = 0;
|
||||||
|
sprites = NULL;
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
blendframes = 0;
|
||||||
|
xdiv = 0;
|
||||||
|
ydiv = 0;
|
||||||
|
zdiv = 0;
|
||||||
|
animcount = 0;
|
||||||
|
xOffset = 0;
|
||||||
|
yOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThingAttributes::~ThingAttributes()
|
||||||
|
{
|
||||||
|
if(sprites)
|
||||||
|
delete []sprites;
|
||||||
|
}
|
||||||
|
|
||||||
Thing::Thing()
|
Thing::Thing()
|
||||||
{
|
{
|
||||||
m_type = TYPE_NONE;
|
m_type = TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Thing::internalDraw(int x, int y, int blendframes, int xdiv, int ydiv, int zdiv, int anim)
|
||||||
|
{
|
||||||
|
ThingAttributes *thingAttributes = getAttributes();
|
||||||
|
if(!thingAttributes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(int yi = 0; yi < thingAttributes->height; yi++) {
|
||||||
|
for(int xi = 0; xi < thingAttributes->width; xi++) {
|
||||||
|
uint16 sprIndex = xi +
|
||||||
|
yi * thingAttributes->width +
|
||||||
|
blendframes * thingAttributes->width * thingAttributes->height +
|
||||||
|
xdiv * thingAttributes->width * thingAttributes->height * thingAttributes->blendframes +
|
||||||
|
ydiv * thingAttributes->width * thingAttributes->height * thingAttributes->blendframes * thingAttributes->xdiv +
|
||||||
|
zdiv * thingAttributes->width * thingAttributes->height * thingAttributes->blendframes * thingAttributes->xdiv * thingAttributes->ydiv +
|
||||||
|
anim * thingAttributes->width * thingAttributes->height * thingAttributes->blendframes * thingAttributes->xdiv * thingAttributes->ydiv * thingAttributes->zdiv;
|
||||||
|
uint16 itemId = thingAttributes->sprites[sprIndex];
|
||||||
|
if(itemId == 0xFFFF)
|
||||||
|
continue;
|
||||||
|
TexturePtr data = g_tibiaSpr.getSprite(itemId);
|
||||||
|
|
||||||
|
int offsetX = 0, offsetY = 0;
|
||||||
|
if(thingAttributes->hasHeight) {
|
||||||
|
offsetX = thingAttributes->xOffset;
|
||||||
|
offsetY = thingAttributes->xOffset; // << look to xoffset
|
||||||
|
}
|
||||||
|
|
||||||
|
g_graphics.drawTexturedRect(Rect((x - xi*32) - offsetX, (y - yi*32) - offsetY, 32, 32), data, Rect(0, 0, 32, 32));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in new issue