* svn properties 2nd try
This commit is contained in:
parent
2029496913
commit
2e59e25ff4
11 changed files with 145 additions and 145 deletions
|
@ -325,4 +325,4 @@ msgid "%s attacked"
|
|||
msgstr "%s attackeras"
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* _______ __ __ __ ______ __ __ _______ __ __
|
||||
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
|
||||
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
|
||||
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
|
||||
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
|
||||
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
|
||||
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
|
||||
/* _______ __ __ __ ______ __ __ _______ __ __
|
||||
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
|
||||
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
|
||||
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
|
||||
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
|
||||
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
|
||||
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
|
||||
*
|
||||
* Copyright (c) 2004, 2005 darkbits Js_./
|
||||
* Per Larsson a.k.a finalman _RqZ{a<^_aa
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// ____ _ __
|
||||
// ____ _ __
|
||||
// / __ )____ _____ | | / /___ ___________
|
||||
// / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
|
||||
// / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
|
||||
// /_____/\____/____/ |__/|__/\__,_/_/ /____/
|
||||
//
|
||||
// / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
|
||||
// /_____/\____/____/ |__/|__/\__,_/_/ /____/
|
||||
//
|
||||
// A futuristic real-time strategy game.
|
||||
// This file is part of Bos Wars.
|
||||
//
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
|
||||
void add(CParticle *particle);
|
||||
void clear();
|
||||
|
||||
|
||||
CPosition getScreenPos(const CPosition &pos);
|
||||
|
||||
inline void setLowDetail(bool detail) { lowDetail = detail; }
|
||||
|
|
|
@ -173,23 +173,23 @@ public:
|
|||
#ifdef DEBUG
|
||||
unsigned int TilesetTile; /// tileset tile number
|
||||
#endif
|
||||
|
||||
|
||||
/// Check if a field for the user is explored.
|
||||
bool IsExplored(const unsigned int player_index) const
|
||||
//bool IsExplored(const CPlayer *const player, bool NoFogOfWar = false) const
|
||||
{
|
||||
//return IsTileVisible(player, index) > 0;
|
||||
#if 1
|
||||
//return IsTileVisible(player, index) > 0;
|
||||
#if 1
|
||||
//return !!Visible[player->Index];
|
||||
return !!Visible[player_index];
|
||||
#else
|
||||
if(!Visible[player->Index])
|
||||
return !!IsVisible(player, NoFogOfWar);
|
||||
return true;
|
||||
return true;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ struct CUnitCache {
|
|||
std::vector<CUnit *> Units;
|
||||
|
||||
CUnitCache() : Units() { Units.clear();}
|
||||
|
||||
|
||||
inline size_t size() const
|
||||
{
|
||||
return Units.size();
|
||||
|
@ -94,18 +94,18 @@ struct CUnitCache {
|
|||
int n = (size+3)/4;
|
||||
const CUnit **cache = (const CUnit **)Units.data();
|
||||
switch (size & 3) {
|
||||
case 0:
|
||||
case 0:
|
||||
do {
|
||||
unit = *cache;
|
||||
if(pred(unit))
|
||||
return (CUnit *)unit;
|
||||
cache++;
|
||||
case 3:
|
||||
case 3:
|
||||
unit = *cache;
|
||||
if(pred(unit))
|
||||
return (CUnit *)unit;
|
||||
cache++;
|
||||
case 2:
|
||||
case 2:
|
||||
unit = *cache;
|
||||
if(pred(unit))
|
||||
return (CUnit *)unit;
|
||||
|
@ -119,7 +119,7 @@ struct CUnitCache {
|
|||
}
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,10 +129,10 @@ struct CUnitCache {
|
|||
*
|
||||
* Applies the function object @p f to each element in the cache.
|
||||
* @p functor must not modify the order of the cache.
|
||||
*/
|
||||
*/
|
||||
template<typename _T>
|
||||
inline void for_each(_T &functor)
|
||||
{
|
||||
{
|
||||
const size_t size = Units.size();
|
||||
#if __GNUC__ < 4
|
||||
for(unsigned int i = 0; i < size; ++i)
|
||||
|
@ -143,7 +143,7 @@ struct CUnitCache {
|
|||
int n = (size+3)/4;
|
||||
CUnit **cache = (CUnit **)Units.data();
|
||||
switch (size & 3) {
|
||||
case 0: do {
|
||||
case 0: do {
|
||||
functor(*cache++);
|
||||
case 3: functor(*cache++);
|
||||
case 2: functor(*cache++);
|
||||
|
@ -162,35 +162,35 @@ struct CUnitCache {
|
|||
* Applies the function object @p f to each element in the cache.
|
||||
* @p functor must not modify the order of the cache.
|
||||
* If @p functor return false then loop is exited.
|
||||
*/
|
||||
*/
|
||||
template<typename _T>
|
||||
inline int for_each_if(_T &functor)
|
||||
{
|
||||
{
|
||||
const size_t size = Units.size();
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
#ifdef _MSC_VER
|
||||
while(size && functor(Units[count]) && ++count < size);
|
||||
while(size && functor(Units[count]) && ++count < size);
|
||||
#else
|
||||
if(size) {
|
||||
int n = (size+3)/4;
|
||||
switch (size & 3) {
|
||||
case 0:
|
||||
case 0:
|
||||
do {
|
||||
if(!functor(Units[count]))
|
||||
return count;
|
||||
count++;
|
||||
case 3:
|
||||
count++;
|
||||
case 3:
|
||||
if(!functor(Units[count]))
|
||||
return count;
|
||||
count++;
|
||||
case 2:
|
||||
count++;
|
||||
case 2:
|
||||
if(!functor(Units[count]))
|
||||
return count;
|
||||
count++;
|
||||
count++;
|
||||
case 1:
|
||||
if(!functor(Units[count]))
|
||||
return count ;
|
||||
count++;
|
||||
count++;
|
||||
} while ( --n > 0 );
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ struct CUnitCache {
|
|||
**
|
||||
** @param index Unit index to remove from container.
|
||||
** @return pointer to removed element.
|
||||
*/
|
||||
*/
|
||||
inline CUnit * Remove(const unsigned int index)
|
||||
{
|
||||
const size_t size = Units.size();
|
||||
|
@ -216,15 +216,15 @@ struct CUnitCache {
|
|||
Units.pop_back();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** Remove unit from unit cache.
|
||||
**
|
||||
** @param unit Unit pointer to remove from container.
|
||||
*/
|
||||
*/
|
||||
inline bool Remove(CUnit *const unit)
|
||||
{
|
||||
#ifndef SECURE_UNIT_REMOVING
|
||||
#ifndef SECURE_UNIT_REMOVING
|
||||
const size_t size = Units.size();
|
||||
if(size == 1 && unit == Units[0]) {
|
||||
Units.pop_back();
|
||||
|
@ -238,7 +238,7 @@ struct CUnitCache {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for(std::vector<CUnit *>::iterator i(Units.begin()), end(Units.end());
|
||||
i != end; ++i) {
|
||||
|
@ -255,7 +255,7 @@ struct CUnitCache {
|
|||
** Remove unit from unit cache.
|
||||
**
|
||||
** @param unit Unit pointer to remove from container.
|
||||
*/
|
||||
*/
|
||||
inline void RemoveS(CUnit *const unit)
|
||||
{
|
||||
for(std::vector<CUnit *>::iterator i(Units.begin()), end(Units.end());
|
||||
|
@ -266,7 +266,7 @@ struct CUnitCache {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** Insert new unit into tile cache.
|
||||
** Sorted version for binary searching.
|
||||
|
|
|
@ -44,7 +44,7 @@ static inline float deg2rad(int degrees) {
|
|||
|
||||
|
||||
CChunkParticle::CChunkParticle(CPosition position, Animation *smokeAnimation) :
|
||||
CParticle(position), initialPos(position), nextSmokeTicks(0), age(0),
|
||||
CParticle(position), initialPos(position), nextSmokeTicks(0), age(0),
|
||||
height(0.f)
|
||||
{
|
||||
float radians = deg2rad(MyRand() % 360);
|
||||
|
@ -76,20 +76,20 @@ void CChunkParticle::draw()
|
|||
CPosition screenPos = ParticleManager.getScreenPos(pos);
|
||||
Uint32 color = ColorBlack;
|
||||
|
||||
Video.DrawRectangleClip(color, (int)screenPos.x - 1,
|
||||
Video.DrawRectangleClip(color, (int)screenPos.x - 1,
|
||||
(int)calculateScreenPos(screenPos.y, height) - 1, 2, 2);
|
||||
}
|
||||
|
||||
static float getHorizontalPosition(int initialVelocity,
|
||||
static float getHorizontalPosition(int initialVelocity,
|
||||
float trajectoryAngle, float time)
|
||||
{
|
||||
return (initialVelocity * cos(trajectoryAngle)) * time;
|
||||
}
|
||||
|
||||
static float getVerticalPosition(int initialVelocity,
|
||||
static float getVerticalPosition(int initialVelocity,
|
||||
float trajectoryAngle, float time)
|
||||
{
|
||||
return (initialVelocity * sin(trajectoryAngle)) * time -
|
||||
return (initialVelocity * sin(trajectoryAngle)) * time -
|
||||
(gravity / 2.0f) * (time * time);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CChunkParticle::update(int ticks)
|
|||
|
||||
float time = age / 1000.f;
|
||||
|
||||
float distance =
|
||||
float distance =
|
||||
getHorizontalPosition(initialVelocity, trajectoryAngle, time);
|
||||
pos.x = initialPos.x + distance * direction.x;
|
||||
pos.y = initialPos.y + distance * direction.y;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// ____ _ __
|
||||
// ____ _ __
|
||||
// / __ )____ _____ | | / /___ ___________
|
||||
// / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
|
||||
// / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
|
||||
// /_____/\____/____/ |__/|__/\__,_/_/ /____/
|
||||
//
|
||||
// / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
|
||||
// /_____/\____/____/ |__/|__/\__,_/_/ /____/
|
||||
//
|
||||
// A futuristic real-time strategy game.
|
||||
// This file is part of Bos Wars.
|
||||
//
|
||||
|
|
|
@ -280,7 +280,7 @@ CUnit *CanBuildHere(const CUnit *unit, const CUnitType *type, int x, int y)
|
|||
const int width = type->TileWidth;
|
||||
int w, h = type->TileHeight;
|
||||
bool success = false;
|
||||
CMapField *mf;
|
||||
CMapField *mf;
|
||||
|
||||
// Need at least one coast tile
|
||||
unsigned int index = Map.getIndex(x, y);
|
||||
|
@ -288,13 +288,13 @@ CUnit *CanBuildHere(const CUnit *unit, const CUnitType *type, int x, int y)
|
|||
mf = Map.Field(index);
|
||||
w = width;
|
||||
do {
|
||||
//if (Map.CoastOnMap(x ,y)) {
|
||||
//if (Map.CoastOnMap(x ,y)) {
|
||||
if((mf->Flags & MapFieldCoastAllowed) == MapFieldCoastAllowed) {
|
||||
success = true;
|
||||
}
|
||||
++mf;
|
||||
} while(!success && --w);
|
||||
index += Map.Info.MapWidth;
|
||||
index += Map.Info.MapWidth;
|
||||
} while(!success && --h);
|
||||
if (!success) {
|
||||
return NULL;
|
||||
|
@ -316,8 +316,8 @@ CUnit *CanBuildHere(const CUnit *unit, const CUnitType *type, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return (unit == NULL) ? (CUnit *)1 : const_cast<CUnit *>(unit);
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ bool CanBuildOn(int x, int y, int mask)
|
|||
return (Map.Info.IsPointOnMap(x,y) && !Map.CheckMask(x, y,mask));
|
||||
}
|
||||
|
||||
extern int
|
||||
extern int
|
||||
MapFogFilterFlags(CPlayer *player, const unsigned int index, int mask);
|
||||
|
||||
/**
|
||||
|
@ -388,13 +388,13 @@ CUnit *CanBuildUnitType(const CUnit *unit,
|
|||
for (w = type->TileWidth; w--;) {
|
||||
/* first part of if (!CanBuildOn(x + w, y + h, testmask)) */
|
||||
if(!Map.Info.IsPointOnMap(x + w, y + h)) {
|
||||
h = type->TileHeight;
|
||||
h = type->TileHeight;
|
||||
ontop = NULL;
|
||||
break;
|
||||
}
|
||||
if (player && !real) {
|
||||
//testmask = MapFogFilterFlags(player, x + w, y + h, type->MovementMask);
|
||||
testmask = MapFogFilterFlags(player,
|
||||
testmask = MapFogFilterFlags(player,
|
||||
index + x + w, type->MovementMask);
|
||||
} else {
|
||||
testmask = type->MovementMask;
|
||||
|
@ -402,12 +402,12 @@ CUnit *CanBuildUnitType(const CUnit *unit,
|
|||
/*secound part of if (!CanBuildOn(x + w, y + h, testmask)) */
|
||||
if(Map.CheckMask(index + x + w,testmask))
|
||||
{
|
||||
h = type->TileHeight;
|
||||
h = type->TileHeight;
|
||||
ontop = NULL;
|
||||
break;
|
||||
}
|
||||
if (player && !Map.IsFieldExplored(player, index + x + w)) {
|
||||
h = type->TileHeight;
|
||||
h = type->TileHeight;
|
||||
ontop = NULL;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ void SaveOrder(const COrderPtr order, CFile *file)
|
|||
case UnitActionBuild:
|
||||
case UnitActionTransformInto:
|
||||
file->printf(", \"type\", \"%s\"", order->Arg1.Type->Ident.c_str());
|
||||
break;
|
||||
break;
|
||||
case UnitActionPatrol:
|
||||
file->printf(", \"patrol\", {%d, %d}",
|
||||
order->Arg1.Patrol.X, order->Arg1.Patrol.Y);
|
||||
|
@ -183,7 +183,7 @@ void SaveOrder(const COrderPtr order, CFile *file)
|
|||
case UnitActionResource :
|
||||
case UnitActionReturnGoods :
|
||||
if (order->CurrentResource) {
|
||||
file->printf(", \"current-resource\", \"%s\",",
|
||||
file->printf(", \"current-resource\", \"%s\",",
|
||||
DefaultResourceNames[order->CurrentResource].c_str());
|
||||
if(order->CurrentResource == WoodCost) {
|
||||
file->printf(" \"resource-pos\", {%d, %d}",
|
||||
|
@ -193,8 +193,8 @@ void SaveOrder(const COrderPtr order, CFile *file)
|
|||
/* this unit is destroyed so it's not in the global unit
|
||||
* array - this means it won't be saved!!! */
|
||||
printf ("FIXME: storing destroyed Mine - loading will fail.\n");
|
||||
}
|
||||
file->printf(" \"resource-mine\", \"%s\"",
|
||||
}
|
||||
file->printf(" \"resource-mine\", \"%s\"",
|
||||
UnitReference(order->Arg1.Resource.Mine).c_str());
|
||||
}
|
||||
}
|
||||
|
@ -365,10 +365,10 @@ void SaveUnit(const CUnit *unit, CFile *file)
|
|||
* array - this means it won't be saved!!! */
|
||||
printf ("FIXME: storing destroyed Worker - loading will fail.\n");
|
||||
}
|
||||
file->printf(" \"next-worker\", \"%s\",",
|
||||
UnitReference(unit->NextWorker).c_str());
|
||||
file->printf(" \"next-worker\", \"%s\",",
|
||||
UnitReference(unit->NextWorker).c_str());
|
||||
}
|
||||
|
||||
|
||||
file->printf(" \"units-boarded-count\", %d,", unit->BoardCount);
|
||||
|
||||
if (unit->UnitInside) {
|
||||
|
@ -416,7 +416,7 @@ void SaveUnit(const CUnit *unit, CFile *file)
|
|||
* array - this means it won't be saved!!! */
|
||||
printf ("FIXME: storing destroyed Worker - loading will fail.\n");
|
||||
}
|
||||
file->printf(", \"first-worker\", \"%s\"",
|
||||
file->printf(", \"first-worker\", \"%s\"",
|
||||
UnitReference(unit->Data.Resource.Workers).c_str());
|
||||
}
|
||||
file->printf("}");
|
||||
|
|
|
@ -11,18 +11,18 @@ struct CPrimitives {
|
|||
virtual void DrawLine(Uint32 color, int sx, int sy, int dx, int dy) = 0;
|
||||
virtual void DrawTransLine(Uint32 color, int sx, int sy,
|
||||
int dx, int dy, unsigned char alpha) = 0;
|
||||
|
||||
|
||||
virtual void DrawRectangle(Uint32 color, int x, int y, int w, int h) = 0;
|
||||
virtual void DrawTransRectangle(Uint32 color, int x, int y,
|
||||
int w, int h, unsigned char alpha) = 0;
|
||||
|
||||
|
||||
virtual void FillTransRectangle(Uint32 color, int x, int y,
|
||||
int w, int h, unsigned char alpha) = 0;
|
||||
|
||||
|
||||
virtual void DrawCircle(Uint32 color, int x, int y, int r) = 0;
|
||||
virtual void DrawTransCircle(Uint32 color, int x, int y,
|
||||
int r, unsigned char alpha) = 0;
|
||||
|
||||
|
||||
virtual void FillCircle(Uint32 color, int x, int y, int r) = 0;
|
||||
virtual void FillTransCircle(Uint32 color, int x, int y,
|
||||
int r, unsigned char alpha) = 0;
|
||||
|
@ -60,7 +60,7 @@ static inline void PutPixel(void *const pixels,
|
|||
};// __attribute__ ((nothrow,nonnull (1)));
|
||||
|
||||
template <const int BPP>
|
||||
static inline void
|
||||
static inline void
|
||||
PutPixelDouble(void *pixels, const unsigned int index, Uint32 color)
|
||||
{
|
||||
if(BPP == 1) {
|
||||
|
@ -88,18 +88,18 @@ PutPixelDouble(void *pixels, const unsigned int index, Uint32 color)
|
|||
};// __attribute__ ((nothrow,nonnull (1)));
|
||||
|
||||
template <const int BPP>
|
||||
static inline void
|
||||
static inline void
|
||||
PutPixelQuatro(void *pixels, unsigned int index, Uint32 color)
|
||||
{
|
||||
if(BPP == 1) {
|
||||
color &= 0xFF;
|
||||
color |= color << 8;
|
||||
color |= color << 16;
|
||||
*((Uint32*)(((Uint8 *)pixels) + index)) = color;
|
||||
*((Uint32*)(((Uint8 *)pixels) + index)) = color;
|
||||
} else if(BPP == 2) {
|
||||
Uint32 *ptr = (Uint32*)(((Uint16 *)pixels) + index);
|
||||
color &= 0xFFFF;
|
||||
color |= color << 16;
|
||||
color |= color << 16;
|
||||
#ifdef __x86_64__
|
||||
Uint64 tmp = color;
|
||||
tmp <<= 32;
|
||||
|
@ -108,7 +108,7 @@ PutPixelQuatro(void *pixels, unsigned int index, Uint32 color)
|
|||
#else
|
||||
*ptr++ = color;
|
||||
*ptr = color;
|
||||
#endif
|
||||
#endif
|
||||
} else if(BPP == 4) {
|
||||
Uint32 *ptr = ((Uint32 *)pixels) + index;
|
||||
#ifdef __x86_64__
|
||||
|
@ -159,17 +159,17 @@ static inline void DrawHLine(void *pixels, unsigned int index,
|
|||
--width;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(((uintptr_t)pixels) & BPP ) {
|
||||
PutPixel<BPP>(pixels, index, color);
|
||||
index++;
|
||||
--width;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
else if(BPP == 4 && ((uintptr_t)pixels) & BPP) {
|
||||
else if(BPP == 4 && ((uintptr_t)pixels) & BPP) {
|
||||
PutPixel<BPP>(pixels, index, color);
|
||||
index++;
|
||||
--width;
|
||||
|
@ -234,8 +234,8 @@ class CRenderer : public CPrimitives {
|
|||
} else {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
*p = (dp >> 16) | dp;
|
||||
}
|
||||
*p = (dp >> 16) | dp;
|
||||
} else if(BPP == 4) {
|
||||
/* RGB888(8) */
|
||||
Uint32 *p = (((Uint32 *)pixels) + index);
|
||||
|
@ -263,7 +263,7 @@ class CRenderer : public CPrimitives {
|
|||
{
|
||||
|
||||
if(BPP == 2) {
|
||||
/*
|
||||
/*
|
||||
#ifdef __x86_64__
|
||||
//FIXME
|
||||
unsigned int dp;
|
||||
|
@ -282,53 +282,53 @@ class CRenderer : public CPrimitives {
|
|||
Uint64 src1 = (src0 | (src0 << 32));
|
||||
Uint64 dst0 = *p;
|
||||
Uint64 dst1 = (dst0 >> 8);
|
||||
|
||||
|
||||
src0 = src1;
|
||||
src1 >>= 8;
|
||||
|
||||
|
||||
src0 &= 0x00FF00FF00FF00FF;
|
||||
src1 &= 0x00FF00FF00FF00FF;
|
||||
|
||||
|
||||
dst0 &= 0x00FF00FF00FF00FF;
|
||||
dst1 &= 0x00FF00FF00FF00FF;
|
||||
|
||||
dst1 &= 0x00FF00FF00FF00FF;
|
||||
|
||||
dst0 += ((src0 - dst0) * A >> 8);
|
||||
dst0 &= 0x00FF00FF00FF00FF;
|
||||
|
||||
|
||||
dst1 += ((src1 - dst1) * A >> 8);
|
||||
dst1 &= 0x00FF00FF00FF00FF;
|
||||
|
||||
|
||||
*p = dst0 | (dst1 << 8);;
|
||||
#else
|
||||
Uint32 *p = (((Uint32 *)pixels) + index);
|
||||
/*
|
||||
* FIXME:
|
||||
* Two Pixels Blend for litle endian and
|
||||
* FIXME:
|
||||
* Two Pixels Blend for litle endian and
|
||||
* big endian may be broken.
|
||||
*/
|
||||
unsigned int d1, s1 = color & 0xff00ff;
|
||||
unsigned int dp = *p;
|
||||
d1 = dp & 0xff00ff;
|
||||
|
||||
color &= 0xff00;
|
||||
d1 = dp & 0xff00ff;
|
||||
|
||||
color &= 0xff00;
|
||||
color = (color >> 8) | (color << 8);
|
||||
|
||||
|
||||
d1 += (s1 - d1) * alpha >> 8;
|
||||
d1 &= 0xff00ff;
|
||||
|
||||
|
||||
dp = ((dp & 0xff00) >> 8) |
|
||||
((p[1] & 0xff00) << 8);
|
||||
|
||||
|
||||
dp += (color - dp) * alpha >> 8;
|
||||
dp &= 0x00ff00ff;
|
||||
|
||||
|
||||
*p++ = d1 | ((dp << 8) & 0xff00) | 0xff000000;
|
||||
|
||||
d1 = *p;
|
||||
d1 &= 0xff00ff;
|
||||
d1 += (s1 - d1) * alpha >> 8;
|
||||
d1 &= 0xff00ff;
|
||||
|
||||
|
||||
*p = d1 | ((dp >> 8) & 0xff00) | 0xff000000;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -344,26 +344,26 @@ class CRenderer : public CPrimitives {
|
|||
/* blend a single 16 bit pixel at 50% */
|
||||
#define BLEND16_50(d, s, mask) \
|
||||
((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff)))
|
||||
|
||||
|
||||
Uint16 *p = (((Uint16 *)pixels) + index);
|
||||
Uint16 d = *p;
|
||||
Uint16 s = color & 0xFFFF; // I hope that caler secure it;
|
||||
|
||||
|
||||
*p = BLEND16_50(d, s, MASK);
|
||||
|
||||
|
||||
#undef BLEND16_50
|
||||
} else if(BPP == 4) {
|
||||
Uint32 *p = (((Uint32 *)pixels) + index);
|
||||
unsigned int d = *p;
|
||||
|
||||
|
||||
*p = ((((color & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
|
||||
+ (color & d & 0x00010101)) | 0xff000000;
|
||||
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static inline void PutTransPixel128Double(void *pixels, const unsigned int index,
|
||||
const Uint32 color)
|
||||
{
|
||||
|
@ -372,23 +372,23 @@ class CRenderer : public CPrimitives {
|
|||
#define BLEND2x16_50(d, s, mask) \
|
||||
(((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \
|
||||
+ (s & d & (~(mask | mask << 16))))
|
||||
|
||||
|
||||
Uint32 *p = (Uint32 *)(((Uint16 *)pixels) + index);
|
||||
Uint32 d = *p;
|
||||
const Uint32 s = (color & 0xFFFF) | color << 16; // I hope that caler secure it;
|
||||
|
||||
|
||||
*p = BLEND2x16_50(d, s, MASK);
|
||||
|
||||
#undef BLEND2x16_50
|
||||
|
||||
#undef BLEND2x16_50
|
||||
} else if(BPP == 4) {
|
||||
Uint32 *p = (((Uint32 *)pixels) + index);
|
||||
#ifdef __x86_64__
|
||||
unsigned long long int d = *(unsigned long long int *)p;
|
||||
unsigned long long int s, c = color;
|
||||
|
||||
|
||||
s = c | c << 32;
|
||||
c = s & 0x00fefefe00fefefe;
|
||||
|
||||
|
||||
*(unsigned long long int *)p =
|
||||
(((c + (d & 0x00fefefe00fefefe)) >> 1)
|
||||
+ (s & d & 0x0001010100010101)) |
|
||||
|
@ -404,7 +404,7 @@ class CRenderer : public CPrimitives {
|
|||
#endif
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
} __attribute__ ((nothrow,nonnull (1)));
|
||||
|
||||
static void DrawVLine(void *pixels, const unsigned int pitch,
|
||||
|
@ -480,7 +480,7 @@ class CRenderer : public CPrimitives {
|
|||
};
|
||||
#ifdef __x86_64__
|
||||
if(width) PutTransPixel(pixels, index, color, alpha);
|
||||
#endif
|
||||
#endif
|
||||
} __attribute__ ((nothrow,nonnull (1)));
|
||||
|
||||
static inline void DrawTransHLine(void *pixels,
|
||||
|
@ -501,7 +501,7 @@ class CRenderer : public CPrimitives {
|
|||
index += x;
|
||||
DRAW::PutPixel<BPP>(TheScreen->pixels, index, color);
|
||||
};
|
||||
|
||||
|
||||
void DrawTransPixel(Uint32 color, int x, int y, unsigned char alpha)
|
||||
{
|
||||
unsigned int index = TheScreen->pitch / BPP;
|
||||
|
@ -554,11 +554,11 @@ class CRenderer : public CPrimitives {
|
|||
dy = sy;
|
||||
sy = t;
|
||||
}
|
||||
|
||||
|
||||
int ylen = dy - sy;
|
||||
int incr;
|
||||
int xlen;
|
||||
|
||||
|
||||
if (sx > dx) {
|
||||
xlen = sx - dx;
|
||||
incr = -1;
|
||||
|
@ -644,17 +644,17 @@ class CRenderer : public CPrimitives {
|
|||
PutTransPixel128(TheScreen->pixels, x + index, color);
|
||||
DRAW::DrawHLine<BPP>(TheScreen->pixels, x + index + 1, w - 2, color); ///(x,y,w)
|
||||
PutTransPixel128(TheScreen->pixels, x + index + w - 1, color);
|
||||
|
||||
|
||||
PutTransPixel128(TheScreen->pixels, x + index + y_offset, color);
|
||||
DRAW::DrawHLine<BPP>(TheScreen->pixels, x + index + y_offset + 1, w - 2, color); // (x, y + h - 1, w)
|
||||
PutTransPixel128(TheScreen->pixels, x + index + y_offset + w - 1, color);
|
||||
|
||||
|
||||
DrawVLine(TheScreen->pixels, pitch, x + index + pitch,
|
||||
h - 2, color); //(x, y + 1, h - 2)
|
||||
DrawVLine(TheScreen->pixels, pitch, x + index + w - 1 + pitch,
|
||||
h - 2, color); //x + w - 1, y + 1, h - 2
|
||||
};
|
||||
|
||||
|
||||
void DrawTransRectangle(Uint32 color, int x, int y,
|
||||
int w, int h, unsigned char alpha)
|
||||
{
|
||||
|
@ -662,28 +662,28 @@ class CRenderer : public CPrimitives {
|
|||
unsigned int index = y * pitch;
|
||||
unsigned int y_offset = (h - 1) * pitch;
|
||||
//unsigned int a = 255 - alpha;
|
||||
|
||||
|
||||
PutTransPixel(TheScreen->pixels, x + index, color, alpha / 2);
|
||||
DrawTransHLine(TheScreen->pixels, x + index + 1, w - 2, color, alpha); ///(x,y,w)
|
||||
PutTransPixel(TheScreen->pixels, x + index + w - 1, color, alpha / 2);
|
||||
|
||||
|
||||
PutTransPixel(TheScreen->pixels, x + index + y_offset, color, alpha / 2);
|
||||
DrawTransHLine(TheScreen->pixels, x + index + y_offset + 1,
|
||||
w - 2, color,alpha); // (x, y + h - 1, w)
|
||||
PutTransPixel(TheScreen->pixels,
|
||||
x + index + y_offset + w - 1, color, alpha / 2);
|
||||
|
||||
|
||||
DrawTransVLine(TheScreen->pixels, pitch, x + index + pitch,
|
||||
h - 2, color, alpha); //(x, y + 1, h - 2)
|
||||
DrawTransVLine(TheScreen->pixels, pitch, x + index + w - 1 + pitch,
|
||||
h - 2, color, alpha); //x + w - 1, y + 1, h - 2
|
||||
h - 2, color, alpha); //x + w - 1, y + 1, h - 2
|
||||
};
|
||||
|
||||
|
||||
void FillTransRectangle(Uint32 color, int x, int y,
|
||||
int w, int h, unsigned char alpha)
|
||||
{
|
||||
const unsigned int pitch = TheScreen->pitch / BPP;
|
||||
unsigned int index = y * pitch;
|
||||
unsigned int index = y * pitch;
|
||||
if(alpha == 128) {
|
||||
do {
|
||||
DrawTransHLine128(TheScreen->pixels, x + index, w, color);
|
||||
|
@ -693,7 +693,7 @@ class CRenderer : public CPrimitives {
|
|||
do {
|
||||
DrawTransHLineNon128(TheScreen->pixels, x + index, w, color, alpha);
|
||||
index += pitch;
|
||||
} while(--h);
|
||||
} while(--h);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -712,7 +712,7 @@ class CRenderer : public CPrimitives {
|
|||
DRAW::PutPixel<BPP>(TheScreen->pixels, x + px + index_minus, color);
|
||||
DRAW::PutPixel<BPP>(TheScreen->pixels, x - px + index_plus, color);
|
||||
DRAW::PutPixel<BPP>(TheScreen->pixels, x - px + index_minus, color);
|
||||
|
||||
|
||||
index_plus = (y + px) * pitch;
|
||||
index_minus = (y - px) * pitch;
|
||||
|
||||
|
@ -727,9 +727,9 @@ class CRenderer : public CPrimitives {
|
|||
p += 2 * (px - py) + 5;
|
||||
py -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void DrawTransCircle(Uint32 color, int x, int y,
|
||||
int r, unsigned char alpha)
|
||||
{
|
||||
|
@ -746,7 +746,7 @@ class CRenderer : public CPrimitives {
|
|||
PutTransPixel(TheScreen->pixels, x + px + index_minus, color,alpha);
|
||||
PutTransPixel(TheScreen->pixels, x - px + index_plus, color,alpha);
|
||||
PutTransPixel(TheScreen->pixels, x - px + index_minus, color,alpha);
|
||||
|
||||
|
||||
index_plus = (y + px) * pitch;
|
||||
index_minus = (y - px) * pitch;
|
||||
|
||||
|
@ -775,14 +775,14 @@ class CRenderer : public CPrimitives {
|
|||
//FIXME: Change it to DrawHLine for speed.
|
||||
unsigned int y_index = y * pitch;
|
||||
unsigned int py_index = py * pitch;
|
||||
|
||||
|
||||
// Fill up the middle half of the circle
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x + px + y_index,
|
||||
py + 1, color);
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x + px + (y_index - py_index),
|
||||
py, color);
|
||||
py, color);
|
||||
|
||||
if (px) {
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
|
@ -790,7 +790,7 @@ class CRenderer : public CPrimitives {
|
|||
py + 1, color);
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x - px + (y_index - py_index),
|
||||
py, color);
|
||||
py, color);
|
||||
}
|
||||
|
||||
if (p < 0) {
|
||||
|
@ -806,18 +806,18 @@ class CRenderer : public CPrimitives {
|
|||
px + 1, color);
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x + py + 1 + (y_index - px_index),
|
||||
px, color);
|
||||
px, color);
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x - py - 1 + y_index,
|
||||
px + 1, color);
|
||||
DrawVLine(TheScreen->pixels, pitch,
|
||||
x - py - 1 + (y_index - px_index),
|
||||
px, color);
|
||||
px, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void FillTransCircle(Uint32 color, int x, int y,
|
||||
int r, unsigned char alpha)
|
||||
{
|
||||
|
@ -830,7 +830,7 @@ class CRenderer : public CPrimitives {
|
|||
//FIXME: Change it to DrawTransHLine for speed.
|
||||
unsigned int y_index = y * pitch;
|
||||
unsigned int py_index = py * pitch;
|
||||
|
||||
|
||||
// Fill up the middle half of the circle
|
||||
DrawTransVLine(TheScreen->pixels, pitch,
|
||||
x + px + y_index,
|
||||
|
@ -872,7 +872,7 @@ class CRenderer : public CPrimitives {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef CRenderer<2,0xfbde> Primitive16_555_t;
|
||||
|
|
Loading…
Reference in a new issue