[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/clone unit_draw.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/clone unit_draw.c |
Date: |
Wed, 22 Oct 2003 15:56:41 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/22 15:56:41
Modified files:
src/clone : unit_draw.c
Log message:
Fixed crash if not using a shadow
Patches:
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.171
stratagus/src/clone/unit_draw.c:1.172
--- stratagus/src/clone/unit_draw.c:1.171 Wed Oct 22 14:02:34 2003
+++ stratagus/src/clone/unit_draw.c Wed Oct 22 15:56:41 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.171 2003/10/22 18:02:34 jsalmon3 Exp $
+// $Id: unit_draw.c,v 1.172 2003/10/22 19:56:41 jsalmon3 Exp $
//@{
@@ -577,7 +577,7 @@
global void SaveDecorations(CLFile* file)
{
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.171
2003/10/22 18:02:34 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.172
2003/10/22 19:56:41 jsalmon3 Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1688,26 +1688,30 @@
cframe = unit->Data.Builded.Frame;
if (cframe->File == ConstructionFileConstruction) {
- x -= (unit->Type->Construction->Width - unit->Type->TileWidth *
TileSizeX) / 2;
- y -= (unit->Type->Construction->Height - unit->Type->TileHeight *
TileSizeY )/ 2;
-// x += type->ShadowOffsetX;
-// y += type->ShadowOffsetY;
- if (frame < 0) {
- VideoDrawShadowClipX(unit->Type->Construction->ShadowSprite,
- -frame, x, y);
- } else {
- VideoDrawShadowClip(unit->Type->Construction->ShadowSprite,
- frame, x, y);
+ if (unit->Type->Construction->ShadowSprite) {
+ x -= (unit->Type->Construction->Width - unit->Type->TileWidth *
TileSizeX) / 2;
+ y -= (unit->Type->Construction->Height - unit->Type->TileHeight *
TileSizeY )/ 2;
+// x += type->ShadowOffsetX;
+// y += type->ShadowOffsetY;
+ if (frame < 0) {
+ VideoDrawShadowClipX(unit->Type->Construction->ShadowSprite,
+ -frame, x, y);
+ } else {
+ VideoDrawShadowClip(unit->Type->Construction->ShadowSprite,
+ frame, x, y);
+ }
}
} else {
- x -= (unit->Type->ShadowWidth - unit->Type->TileWidth * TileSizeX) / 2;
- y -= (unit->Type->ShadowHeight - unit->Type->TileHeight * TileSizeY) /
2;
- x += unit->Type->ShadowOffsetX;
- y += unit->Type->ShadowOffsetY;
- if (frame < 0) {
- VideoDrawShadowClipX(unit->Type->ShadowSprite, -frame, x, y);
- } else {
- VideoDrawShadowClip(unit->Type->ShadowSprite, frame, x, y);
+ if (unit->Type->ShadowSprite) {
+ x -= (unit->Type->ShadowWidth - unit->Type->TileWidth * TileSizeX)
/ 2;
+ y -= (unit->Type->ShadowHeight - unit->Type->TileHeight *
TileSizeY) / 2;
+ x += unit->Type->ShadowOffsetX;
+ y += unit->Type->ShadowOffsetY;
+ if (frame < 0) {
+ VideoDrawShadowClipX(unit->Type->ShadowSprite, -frame, x, y);
+ } else {
+ VideoDrawShadowClip(unit->Type->ShadowSprite, frame, x, y);
+ }
}
}
}