[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src action/action_build.c action/acti...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src action/action_build.c action/acti... |
Date: |
17 Jan 2004 18:26:12 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/17 18:26:11
Modified files:
src/action : action_build.c action_still.c actions.c
src/missile : missile.c
src/stratagus : construct.c
src/unit : unit.c unit_draw.c unittype.c
Log message:
Fixed FancyBuildings
Patches:
Index: stratagus/src/action/action_build.c
diff -u stratagus/src/action/action_build.c:1.107
stratagus/src/action/action_build.c:1.108
--- stratagus/src/action/action_build.c:1.107 Thu Jan 15 09:31:01 2004
+++ stratagus/src/action/action_build.c Sat Jan 17 18:26:07 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_build.c,v 1.107 2004/01/14 22:31:01 nobody_ Exp $
+// $Id: action_build.c,v 1.108 2004/01/17 07:26:07 jsalmon3 Exp $
//@{
@@ -78,7 +78,11 @@
}
if (cframe != unit->Data.Builded.Frame) {
unit->Data.Builded.Frame = cframe;
- unit->Frame = cframe->Frame;
+ if (unit->Frame < 0) {
+ unit->Frame = -cframe->Frame - 1;
+ } else {
+ unit->Frame = cframe->Frame;
+ }
CheckUnitToBeDrawn(unit);
}
}
@@ -354,7 +358,11 @@
// HACK: the building is ready now
unit->Player->UnitTypesCount[type->Type]++;
unit->Constructed = 0;
- unit->Frame = 0;
+ if (unit->Frame < 0) {
+ unit->Frame = -1;
+ } else {
+ unit->Frame = 0;
+ }
unit->Reset = unit->Wait = 1;
if ((worker = unit->Data.Builded.Worker)) {
Index: stratagus/src/action/action_still.c
diff -u stratagus/src/action/action_still.c:1.79
stratagus/src/action/action_still.c:1.80
--- stratagus/src/action/action_still.c:1.79 Sat Jan 17 01:40:13 2004
+++ stratagus/src/action/action_still.c Sat Jan 17 18:26:07 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_still.c,v 1.79 2004/01/16 14:40:13 wizzard Exp $
+// $Id: action_still.c,v 1.80 2004/01/17 07:26:07 jsalmon3 Exp $
//@{
@@ -101,10 +101,18 @@
// FIXME: the frames are hardcoded they should be configurable
//
if (unit->State == 1 && type->GivesResource == GoldCost) {
- unit->Frame = unit->Data.Resource.Active ? 1 : 0;
+ if (unit->Frame < 0) {
+ unit->Frame = unit->Data.Resource.Active ? -1 -
1 : -1;
+ } else {
+ unit->Frame = unit->Data.Resource.Active ? 1 :
0;
+ }
}
if (unit->State == 1 && type->GivesResource == OilCost) {
- unit->Frame = unit->Data.Resource.Active ? 2 : 0;
+ if (unit->Frame < 0) {
+ unit->Frame = unit->Data.Resource.Active ? -2 -
1 : -1;
+ } else {
+ unit->Frame = unit->Data.Resource.Active ? 2 :
0;
+ }
}
}
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.113
stratagus/src/action/actions.c:1.114
--- stratagus/src/action/actions.c:1.113 Thu Jan 15 10:17:26 2004
+++ stratagus/src/action/actions.c Sat Jan 17 18:26:07 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: actions.c,v 1.113 2004/01/14 23:17:26 nobody_ Exp $
+// $Id: actions.c,v 1.114 2004/01/17 07:26:07 jsalmon3 Exp $
//@{
@@ -77,7 +77,11 @@
int flags;
if (!(state = unit->State)) {
- unit->Frame = 0;
+ if (unit->Frame < 0) {
+ unit->Frame = -1;
+ } else {
+ unit->Frame = 0;
+ }
UnitUpdateHeading(unit); // FIXME: remove this!!
}
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.127
stratagus/src/missile/missile.c:1.128
--- stratagus/src/missile/missile.c:1.127 Sat Jan 17 06:22:15 2004
+++ stratagus/src/missile/missile.c Sat Jan 17 18:26:07 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.127 2004/01/16 19:22:15 wizzard Exp $
+// $Id: missile.c,v 1.128 2004/01/17 07:26:07 jsalmon3 Exp $
//@{
@@ -676,9 +676,9 @@
if (mtype->Flip) {
if (frame < 0) {
if (mtype->Transparency == 50) {
- VideoDrawClipXTrans50(mtype->Sprite, -frame, x,
y);
+ VideoDrawClipXTrans50(mtype->Sprite, -frame -
1, x, y);
} else {
- VideoDrawClipX(mtype->Sprite, -frame, x, y);
+ VideoDrawClipX(mtype->Sprite, -frame - 1, x, y);
}
} else {
if (mtype->Transparency == 50) {
@@ -692,7 +692,7 @@
row = mtype->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) * mtype->NumDirections +
mtype->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) * mtype->NumDirections +
mtype->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) * mtype->NumDirections + frame %
row;
}
@@ -787,7 +787,7 @@
}
// reinitialise the direction but with skipping Animation step.
if (missile->SpriteFrame < 0) {
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
}
missile->SpriteFrame /= missile->Type->NumDirections / 2 + 1;
missile->SpriteFrame *= missile->Type->NumDirections / 2 + 1;
@@ -801,6 +801,9 @@
DebugCheck(dir >= missile->Type->NumDirections);
DebugCheck(dir < -missile->Type->NumDirections + 1);
missile->SpriteFrame = dir;
+ if (missile->SpriteFrame < 0) {
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
+ }
}
/**
@@ -1124,7 +1127,7 @@
NumDirections = missile->Type->NumDirections;
if (missile->SpriteFrame < 0) {
neg = 1;
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
}
if (LongAnimation) {
int totalf; // Total number of frame (for one direction).
@@ -1154,7 +1157,7 @@
}
}
if (neg) {
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
}
DebugLevel3Fn("Frame %d of %d\n" _C_
missile->SpriteFrame _C_ missile->Type->SpriteFrames);
@@ -1179,7 +1182,7 @@
neg = 0;
if (missile->SpriteFrame < 0) {
neg = 1;
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
}
totalx = abs(missile->DX - missile->SourceX);
dx = abs(missile->X - missile->SourceX);
@@ -1198,7 +1201,7 @@
}
}
if (neg) {
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame - 1;
}
}
@@ -1317,7 +1320,7 @@
DebugCheck(file == NULL);
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.127
2004/01/16 19:22:15 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.128
2004/01/17 07:26:07 jsalmon3 Exp $\n\n");
//
// Original number to internal missile-type name.
@@ -1439,7 +1442,7 @@
Missile* const* missiles;
CLprintf(file,"\n--- -----------------------------------------\n");
- CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.127 2004/01/16
19:22:15 wizzard Exp $\n\n");
+ CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.128 2004/01/17
07:26:07 jsalmon3 Exp $\n\n");
for (missiles = GlobalMissiles; *missiles; ++missiles) {
SaveMissile(*missiles, file);
Index: stratagus/src/stratagus/construct.c
diff -u stratagus/src/stratagus/construct.c:1.47
stratagus/src/stratagus/construct.c:1.48
--- stratagus/src/stratagus/construct.c:1.47 Sat Jan 17 02:17:30 2004
+++ stratagus/src/stratagus/construct.c Sat Jan 17 18:26:09 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: construct.c,v 1.47 2004/01/16 15:17:30 wizzard Exp $
+// $Id: construct.c,v 1.48 2004/01/17 07:26:09 jsalmon3 Exp $
//@{
@@ -109,6 +109,7 @@
ShowLoadProgress("Construction %s", file);
(*cop)->Sprite = LoadSprite(file,
(*cop)->Width, (*cop)->Height);
+ FlipGraphic((*cop)->Sprite);
}
file = (*cop)->ShadowFile[TheMap.Terrain].File;
if (file) {
@@ -127,6 +128,7 @@
ShowLoadProgress("Construction %s", file);
(*cop)->ShadowSprite = LoadSprite(file,
(*cop)->ShadowWidth,
(*cop)->ShadowHeight);
+ FlipGraphic((*cop)->ShadowSprite);
}
++cop;
}
@@ -148,7 +150,7 @@
ConstructionFrame* cframe;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.47
2004/01/16 15:17:30 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.48
2004/01/17 07:26:09 jsalmon3 Exp $\n\n");
// FIXME: needed?
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.362 stratagus/src/unit/unit.c:1.363
--- stratagus/src/unit/unit.c:1.362 Sat Jan 17 14:40:03 2004
+++ stratagus/src/unit/unit.c Sat Jan 17 18:26:09 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.362 2004/01/17 03:40:03 wizzard Exp $
+// $Id: unit.c,v 1.363 2004/01/17 07:26:09 jsalmon3 Exp $
//@{
@@ -418,6 +418,16 @@
AssignUnitToPlayer(unit, player);
}
+ if (type->Building) {
+ //
+ // fancy buildings: mirror buildings (but shadows not correct)
+ //
+ if (FancyBuildings && unit->Rs > 50) {
+ unit->Frame = -unit->Frame - 1;
+ }
+ }
+
+
return unit;
}
@@ -516,17 +526,6 @@
Unit* unit;
unit = MakeUnit(type, player);
-
- if (type->Building) {
- //
- // fancy buildings: mirror buildings (but shadows
not correct)
- //
- if (FancyBuildings && unit->Rs > 50) {
- // FIXME: doesn't work if Frame is 0
- unit->Frame = -unit->Frame;
- }
- }
-
PlaceUnit(unit, x, y);
return unit;
@@ -1755,9 +1754,13 @@
{
int dir;
int nextdir;
+ int neg;
if (unit->Frame < 0) {
- unit->Frame = -unit->Frame;
+ unit->Frame = -unit->Frame - 1;
+ neg = 1;
+ } else {
+ neg = 0;
}
unit->Frame /= unit->Type->NumDirections / 2 + 1;
unit->Frame *= unit->Type->NumDirections / 2 + 1;
@@ -1769,7 +1772,10 @@
unit->Frame += dir;
} else {
unit->Frame += 256 / nextdir - dir;
- unit->Frame = -unit->Frame;
+ unit->Frame = -unit->Frame - 1;
+ }
+ if (neg && !unit->Frame && unit->Type->Building) {
+ unit->Frame = -1;
}
}
@@ -3558,11 +3564,11 @@
CLprintf(file, "\"seen-pixel\", {%d, %d}, ", unit->Seen.IX,
unit->Seen.IY);
CLprintf(file, "\"%sframe\", %d, ",
unit->Frame < 0 ? "flipped-" : "",
- unit->Frame < 0 ? -unit->Frame : unit->Frame);
+ unit->Frame < 0 ? -unit->Frame - 1 : unit->Frame);
if (unit->Seen.Frame != UnitNotSeen) {
CLprintf(file, "\"%sseen\", %d, ",
unit->Seen.Frame < 0 ? "flipped-" : "",
- unit->Seen.Frame < 0 ? -unit->Seen.Frame :
unit->Seen.Frame);
+ unit->Seen.Frame < 0 ? -unit->Seen.Frame - 1 :
unit->Seen.Frame);
} else {
CLprintf(file, "\"not-seen\", ");
}
@@ -3780,7 +3786,7 @@
int j;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.362 2004/01/17
03:40:03 wizzard Exp $\n\n");
+ CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.363 2004/01/17
07:26:09 jsalmon3 Exp $\n\n");
#if 0
//
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.211
stratagus/src/unit/unit_draw.c:1.212
--- stratagus/src/unit/unit_draw.c:1.211 Sat Jan 17 06:22:17 2004
+++ stratagus/src/unit/unit_draw.c Sat Jan 17 18:26:10 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.211 2004/01/16 19:22:17 wizzard Exp $
+// $Id: unit_draw.c,v 1.212 2004/01/17 07:26:10 jsalmon3 Exp $
//@{
@@ -631,7 +631,7 @@
{
#if 0
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.211
2004/01/16 19:22:17 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.212
2004/01/17 07:26:10 jsalmon3 Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1199,7 +1199,7 @@
y += type->ShadowOffsetY;
if (type->Flip) {
if (frame < 0) {
-
VideoDrawShadowClipX(type->ShadowSprite, -frame, x, y);
+
VideoDrawShadowClipX(type->ShadowSprite, -frame - 1, x, y);
} else {
VideoDrawShadowClip(type->ShadowSprite,
frame, x, y);
}
@@ -1208,7 +1208,7 @@
row = type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) *
type->NumDirections + type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) *
type->NumDirections + type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) *
type->NumDirections + frame % row;
}
@@ -1233,7 +1233,7 @@
if (type->Flip) {
if (frame < 0) {
- VideoDrawShadowClipX(type->ShadowSprite,
-frame, x, y);
+ VideoDrawShadowClipX(type->ShadowSprite, -frame
- 1, x, y);
} else {
VideoDrawShadowClip(type->ShadowSprite, frame,
x, y);
}
@@ -1242,7 +1242,7 @@
row = type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) *
type->NumDirections + type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) * type->NumDirections +
frame % row;
}
@@ -1706,9 +1706,9 @@
if (!type->PlayerColorSprite[player] ||
!type->PlayerColorSprite[player]->TextureNames[
type->Flip ?
- (frame < 0 ? -frame : frame) :
+ (frame < 0 ? -frame - 1 : frame) :
(frame < 0 ?
- (-frame / (type->NumDirections
/ 2 + 1)) * type->NumDirections +
+ ((-frame - 1) /
(type->NumDirections / 2 + 1)) * type->NumDirections +
type->NumDirections -
-frame % (type->NumDirections / 2 + 1) :
(frame / (type->NumDirections /
2 + 1)) * type->NumDirections +
frame %
(type->NumDirections / 2 + 1))]) {
@@ -1728,7 +1728,7 @@
}
fprintf(stderr,"%s (%d)\n", type->Ident, player);
MakePlayerColorTexture(&((UnitType*)type)->PlayerColorSprite[player],
- type->Sprite, frame < 0 ? -frame : frame, mapping, 4);
+ type->Sprite, frame < 0 ? -frame - 1 : frame, mapping,
4);
}
// FIXME: move this calculation to high level.
@@ -1737,7 +1737,7 @@
if (type->Flip) {
if (frame < 0) {
- VideoDrawClipX(type->PlayerColorSprite[player], -frame,
x, y);
+ VideoDrawClipX(type->PlayerColorSprite[player], -frame
- 1, x, y);
} else {
VideoDrawClip(type->PlayerColorSprite[player], frame,
x, y);
}
@@ -1746,7 +1746,7 @@
row = type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) * type->NumDirections +
type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) * type->NumDirections + frame %
row;
}
@@ -1777,7 +1777,7 @@
if (unit->Type->Flip) {
if (frame < 0) {
VideoDrawShadowClipX(unit->Type->Construction->ShadowSprite,
- -frame, x, y);
+ -frame - 1, x, y);
} else {
VideoDrawShadowClip(unit->Type->Construction->ShadowSprite,
frame, x, y);
@@ -1787,7 +1787,7 @@
row = unit->Type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) *
unit->Type->NumDirections + unit->Type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) *
unit->Type->NumDirections + unit->Type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) *
unit->Type->NumDirections + frame % row;
}
@@ -1803,7 +1803,7 @@
y += unit->Type->ShadowOffsetY;
if (unit->Type->Flip) {
if (frame < 0) {
-
VideoDrawShadowClipX(unit->Type->ShadowSprite, -frame, x, y);
+
VideoDrawShadowClipX(unit->Type->ShadowSprite, -frame - 1, x, y);
} else {
VideoDrawShadowClip(unit->Type->ShadowSprite, frame, x, y);
}
@@ -1812,7 +1812,7 @@
row = unit->Type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) *
unit->Type->NumDirections + unit->Type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) *
unit->Type->NumDirections + unit->Type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) *
unit->Type->NumDirections + frame % row;
}
@@ -1840,7 +1840,11 @@
x -= construction->Width / 2;
y -= construction->Height / 2;
GraphicUnitPixels(unit, construction->Sprite);
- VideoDrawClip(construction->Sprite, frame, x, y);
+ if (frame < 0) {
+ VideoDrawClipX(construction->Sprite, -frame - 1, x, y);
+ } else {
+ VideoDrawClip(construction->Sprite, frame, x, y);
+ }
} else {
x -= type->TileWidth * TileSizeX / 2;
y -= type->TileHeight * TileSizeY / 2;
@@ -1969,10 +1973,10 @@
} else if (state == 2) {
// FIXME: this frame is hardcoded!!!
GraphicUnitPixels(unit, type->Sprite);
- DrawUnitType(type, sprite, frame < 0 ? -1 : 1, x, y);
+ DrawUnitType(type, sprite, frame < 0 ? -1 - 1 : 1, x, y);
#ifdef USE_OPENGL
DrawUnitPlayerColor(type, unit->Player->Player,
- frame < 0 ? -1 : 1, x, y);
+ frame < 0 ? -1 - 1 : 1, x, y);
#endif
} else {
DrawUnitType(type, sprite, frame, x, y);
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.144 stratagus/src/unit/unittype.c:1.145
--- stratagus/src/unit/unittype.c:1.144 Sat Jan 17 06:22:17 2004
+++ stratagus/src/unit/unittype.c Sat Jan 17 18:26:10 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.144 2004/01/16 19:22:17 wizzard Exp $
+// $Id: unittype.c,v 1.145 2004/01/17 07:26:10 jsalmon3 Exp $
//@{
@@ -1187,7 +1187,7 @@
// char** sp;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.144
2004/01/16 19:22:17 wizzard Exp $\n\n");
+ CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.145
2004/01/17 07:26:10 jsalmon3 Exp $\n\n");
#if 0
// Original number to internal unit-type name.
@@ -1307,7 +1307,7 @@
if (type->Flip) {
if (frame < 0) {
- VideoDrawClipX(sprite, -frame, x, y);
+ VideoDrawClipX(sprite, -frame - 1, x, y);
} else {
VideoDrawClip(sprite, frame, x, y);
}
@@ -1316,7 +1316,7 @@
row = type->NumDirections / 2 + 1;
if (frame < 0) {
- frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ frame = ((-frame - 1) / row) * type->NumDirections +
type->NumDirections - (-frame - 1) % row;
} else {
frame = (frame / row) * type->NumDirections + frame %
row;
}
- [Stratagus-CVS] stratagus/src action/action_build.c action/acti...,
address@hidden <=