stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src include/missile.h missile/missile...


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src include/missile.h missile/missile...
Date: 17 Jan 2004 06:22:20 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/17 06:22:19

Modified files:
        src/include    : missile.h 
        src/missile    : missile.c 
        src/stratagus  : mainloop.c 
        src/unit       : unit_draw.c unittype.c 
        src/video      : cursor.c 

Log message:
        DYNAMIC_LOAD is a compile option, otherwise all sprites are loaded on 
game start

Patches:
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.80 
stratagus/src/include/missile.h:1.81
--- stratagus/src/include/missile.h:1.80        Fri Jan 16 21:35:33 2004
+++ stratagus/src/include/missile.h     Sat Jan 17 06:22:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: missile.h,v 1.80 2004/01/16 10:35:33 wizzard Exp $
+//      $Id: missile.h,v 1.81 2004/01/16 19:22:15 wizzard Exp $
 
 #ifndef __MISSILE_H__
 #define __MISSILE_H__
@@ -504,6 +504,8 @@
 
        /// load the graphics for a missile type
 extern void LoadMissileSprite(MissileType* mtype);
+       /// load all missile sprites
+extern void LoadMissileSprites();
        /// allocate an empty missile-type slot
 extern MissileType* NewMissileTypeSlot(char*);
        /// Get missile-type by ident
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.126 
stratagus/src/missile/missile.c:1.127
--- stratagus/src/missile/missile.c:1.126       Fri Jan 16 21:35:34 2004
+++ stratagus/src/missile/missile.c     Sat Jan 17 06:22:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: missile.c,v 1.126 2004/01/16 10:35:34 wizzard Exp $
+//      $Id: missile.c,v 1.127 2004/01/16 19:22:15 wizzard Exp $
 
 //@{
 
@@ -168,6 +168,19 @@
 }
 
 /**
+**  Load the graphics for all missiles types
+*/
+global void LoadMissileSprites(void)
+{
+#ifndef DYNAMIC_LOAD
+       int i;
+
+       for (i = 0; MissileTypes[i].OType; ++i) {
+               LoadMissileSprite(&MissileTypes[i]);
+       }
+#endif
+}
+/**
 **  Get Missile type by identifier.
 **
 **  @param ident  Identifier.
@@ -1304,7 +1317,7 @@
 
        DebugCheck(file == NULL);
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.126 
2004/01/16 10:35:34 wizzard Exp $\n\n");
+       CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.127 
2004/01/16 19:22:15 wizzard Exp $\n\n");
 
        //
        // Original number to internal missile-type name.
@@ -1426,7 +1439,7 @@
        Missile* const* missiles;
 
        CLprintf(file,"\n--- -----------------------------------------\n");
-       CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.126 2004/01/16 
10:35:34 wizzard Exp $\n\n");
+       CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.127 2004/01/16 
19:22:15 wizzard Exp $\n\n");
 
        for (missiles = GlobalMissiles; *missiles; ++missiles) {
                SaveMissile(*missiles, file);
Index: stratagus/src/stratagus/mainloop.c
diff -u stratagus/src/stratagus/mainloop.c:1.180 
stratagus/src/stratagus/mainloop.c:1.181
--- stratagus/src/stratagus/mainloop.c:1.180    Fri Jan 16 21:35:35 2004
+++ stratagus/src/stratagus/mainloop.c  Sat Jan 17 06:22:16 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: mainloop.c,v 1.180 2004/01/16 10:35:35 wizzard Exp $
+//      $Id: mainloop.c,v 1.181 2004/01/16 19:22:16 wizzard Exp $
 
 //@{
 
@@ -408,9 +408,11 @@
                                y = missiletable[j]->Y - vp->MapY * TileSizeY + 
vp->Y;
                                // FIXME: I should copy SourcePlayer for second 
level missiles.
                                if (missiletable[j]->SourceUnit && 
missiletable[j]->SourceUnit->Player) {
+#ifdef DYNAMIC_LOAD
                                        if (!missiletable[j]->Type->Sprite) {
                                                
LoadMissileSprite(missiletable[j]->Type);
                                        }
+#endif
                                        
GraphicPlayerPixels(missiletable[j]->SourceUnit->Player,
                                                        
missiletable[j]->Type->Sprite);
                                }
@@ -436,9 +438,11 @@
                        y = missiletable[j]->Y - vp->MapY * TileSizeY + vp->Y;
                        // FIXME: I should copy SourcePlayer for second level 
missiles.
                        if (missiletable[j]->SourceUnit && 
missiletable[j]->SourceUnit->Player) {
+#ifdef DYNAMIC_LOAD
                                if (!missiletable[j]->Type->Sprite) {
                                        
LoadMissileSprite(missiletable[j]->Type);
                                }
+#endif
                                
GraphicPlayerPixels(missiletable[j]->SourceUnit->Player,
                                        missiletable[j]->Type->Sprite);
                        }
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.210 
stratagus/src/unit/unit_draw.c:1.211
--- stratagus/src/unit/unit_draw.c:1.210        Sat Jan 17 05:40:03 2004
+++ stratagus/src/unit/unit_draw.c      Sat Jan 17 06:22:17 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit_draw.c,v 1.210 2004/01/16 18:40:03 nobody_ Exp $
+//      $Id: unit_draw.c,v 1.211 2004/01/16 19:22:17 wizzard Exp $
 
 //@{
 
@@ -631,7 +631,7 @@
 {
 #if 0
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.210 
2004/01/16 18:40:03 nobody_ Exp $\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, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
                ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1901,9 +1901,11 @@
                cframe = unit->Seen.CFrame;
        }
 
+#ifdef DYNAMIC_LOAD
        if (!type->Sprite) {
                LoadUnitTypeSprite(type);
        }
+#endif
 
        if ((!UnitVisible(unit, ThisPlayer)) && frame == UnitNotSeen) {
                DebugLevel0Fn("FIXME: Something is wrong, unit %d not seen but 
drawn time %lu?.\n" _C_
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.143 stratagus/src/unit/unittype.c:1.144
--- stratagus/src/unit/unittype.c:1.143 Sat Jan 17 05:17:26 2004
+++ stratagus/src/unit/unittype.c       Sat Jan 17 06:22:17 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unittype.c,v 1.143 2004/01/16 18:17:26 nobody_ Exp $
+//      $Id: unittype.c,v 1.144 2004/01/16 19:22:17 wizzard Exp $
 
 //@{
 
@@ -1187,7 +1187,7 @@
 //     char** sp;
 
        CLprintf(file, "\n--- -----------------------------------------\n");
-       CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.143 
2004/01/16 18:17:26 nobody_ Exp $\n\n");
+       CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.144 
2004/01/16 19:22:17 wizzard Exp $\n\n");
 #if 0
        // Original number to internal unit-type name.
 
@@ -1427,7 +1427,7 @@
        UnitType* type;
        int i;
 
-       for (i = 0; i<NumUnitTypes; ++i) {
+       for (i = 0; i < NumUnitTypes; ++i) {
                type = UnitTypes[i];
 
                //
@@ -1451,7 +1451,16 @@
                if (type->CorpseName) {
                        type->CorpseType = UnitTypeByIdent(type->CorpseName);
                }
-
+               
+               //
+               // Load Sprite
+               //
+#ifndef DYNAMIC_LOAD
+               if (!type->Sprite) {
+                       ShowLoadProgress("Unit \"%s\"", type->Name);
+                       LoadUnitTypeSprite(type);
+               }
+#endif
                // FIXME: should i copy the animations of same graphics?
        }
 }
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.96 stratagus/src/video/cursor.c:1.97
--- stratagus/src/video/cursor.c:1.96   Sat Jan 17 05:17:28 2004
+++ stratagus/src/video/cursor.c        Sat Jan 17 06:22:18 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: cursor.c,v 1.96 2004/01/16 18:17:28 nobody_ Exp $
+//      $Id: cursor.c,v 1.97 2004/01/16 19:22:18 wizzard Exp $
 
 //@{
 
@@ -512,9 +512,11 @@
        //
        //              Draw building
        //
+#ifdef DYNAMIC_LOAD
        if (!CursorBuilding->Sprite) {
                LoadUnitTypeSprite(CursorBuilding);
        }
+#endif
        frame = CursorBuilding->Animations->Still[0].Frame +
                (CursorBuilding->Building ? 0 : CursorBuilding->NumDirections / 
2 + 1 - 1);
        PushClipping();
@@ -833,7 +835,7 @@
        int i;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.96 2004/01/16 
18:17:28 nobody_ Exp $\n\n");
+       CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.97 2004/01/16 
19:22:18 wizzard Exp $\n\n");
 
        for (i = 0; Cursors[i].OType; ++i) {
                CLprintf(file, "(define-cursor '%s '%s\n",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]