stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus data/ccl/anim.ccl data/ccl/sound.ccl ...


From: Jimmy Salmon
Subject: [Stratagus-CVS] stratagus data/ccl/anim.ccl data/ccl/sound.ccl ...
Date: Sat, 01 Nov 2003 23:20:39 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Jimmy Salmon <address@hidden>   03/11/01 23:20:38

Modified files:
        data/ccl       : anim.ccl sound.ccl 
        data/ccl/human : units.ccl 
        data/ccl/orc   : units.ccl 
        src/action     : action_resource.c 
        src/include    : sound.h unit.h unitsound.h unittype.h 
        src/sound      : sound.c unitsound.c 
        src/unit       : ccl_unittype.c unittype.c 

Log message:
        Added harvest animation and sound, removed tree chopping sound

Patches:
Index: stratagus/data/ccl/anim.ccl
diff -u stratagus/data/ccl/anim.ccl:1.22 stratagus/data/ccl/anim.ccl:1.23
--- stratagus/data/ccl/anim.ccl:1.22    Fri Oct 31 01:18:55 2003
+++ stratagus/data/ccl/anim.ccl Sat Nov  1 23:20:36 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: anim.ccl,v 1.22 2003/10/31 06:18:55 jsalmon3 Exp $
+;;     $Id: anim.ccl,v 1.23 2003/11/02 04:20:36 jsalmon3 Exp $
 
 ;;------
 ;;     Footman, Grunt, Grom Hellscream, Danath, Korgath Bladefist
@@ -52,7 +52,7 @@
     #( 0 3   2   0) #( 0 3   1   5) #( 0 3   2   5) #( 0 2   1  10)
     #( 0 3   1  10) #( 0 2   1   0) #( 0 3   2   0) #( 0 3   1  15)
     #( 0 3   2  15) #( 0 2   1  20) #( 0 3   1  20) #( 3 2   1   0))
-  'attack '(   ; #25
+  'harvest 'wood '(    ; #25
     #( 0 0   3  25) #( 0 0   3  30) #( 0 0   3  35) #(12 0   5  40)
     #( 0 0   3  45) #( 0 0   7  25) #( 3 0   1  25))
   'repair '(   ; #25
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.47 
stratagus/data/ccl/human/units.ccl:1.48
--- stratagus/data/ccl/human/units.ccl:1.47     Fri Oct 31 01:18:55 2003
+++ stratagus/data/ccl/human/units.ccl  Sat Nov  1 23:20:36 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.47 2003/10/31 06:18:55 jsalmon3 Exp $
+;;     $Id: units.ccl,v 1.48 2003/11/02 04:20:36 jsalmon3 Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -110,6 +110,7 @@
     acknowledge "peasant-acknowledge"
     ready "peasant-ready"
 ;    repair "peasant-attack"
+    harvest wood "tree chopping"
     help "basic human voices help 1"
     dead "basic human voices dead"
     attack "peasant-attack"))
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.49 
stratagus/data/ccl/orc/units.ccl:1.50
--- stratagus/data/ccl/orc/units.ccl:1.49       Fri Oct 31 01:18:55 2003
+++ stratagus/data/ccl/orc/units.ccl    Sat Nov  1 23:20:36 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.49 2003/10/31 06:18:55 jsalmon3 Exp $
+;;     $Id: units.ccl,v 1.50 2003/11/02 04:20:36 jsalmon3 Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -106,6 +106,7 @@
     acknowledge "peon-acknowledge"
     ready "peon-ready"
 ;    repair "peon-attack"
+    harvest wood "tree chopping"
     help "basic orc voices help 1"
     dead "basic orc voices dead"
     attack "peon-attack"))
Index: stratagus/data/ccl/sound.ccl
diff -u stratagus/data/ccl/sound.ccl:1.37 stratagus/data/ccl/sound.ccl:1.38
--- stratagus/data/ccl/sound.ccl:1.37   Fri Oct 31 01:18:55 2003
+++ stratagus/data/ccl/sound.ccl        Sat Nov  1 23:20:36 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: sound.ccl,v 1.37 2003/10/31 06:18:55 jsalmon3 Exp $
+;;     $Id: sound.ccl,v 1.38 2003/11/02 04:20:36 jsalmon3 Exp $
 
 ;;     Uncomment this to enable threaded sound
 ;(sound-thread)
@@ -819,7 +819,6 @@
   'click sound-click
 
 ; FIXME: Not ready
-;  'tree-chopping (make-sound "tree chopping" "tree_chopping.wav")
 ;  'transport-docking
 ;  'building-construction
 
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.63 
stratagus/src/action/action_resource.c:1.64
--- stratagus/src/action/action_resource.c:1.63 Fri Oct 31 13:16:31 2003
+++ stratagus/src/action/action_resource.c      Sat Nov  1 23:20:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_resource.c,v 1.63 2003/10/31 18:16:31 jsalmon3 Exp $
+//     $Id: action_resource.c,v 1.64 2003/11/02 04:20:37 jsalmon3 Exp $
 
 //@{
 
@@ -266,12 +266,12 @@
     int flags;
 
     if (unit->Type->Animations) {
-       //FIXME: Animation->Harvest
-       DebugCheck(!unit->Type->Animations->Attack);
-       flags = UnitShowAnimation(unit, unit->Type->Animations->Attack);
+       DebugCheck(!unit->Type->Animations->Harvest[unit->CurrentResource]);
+       flags = UnitShowAnimation(unit,
+           unit->Type->Animations->Harvest[unit->CurrentResource]);
 #ifdef WITH_SOUND
        if ((flags & AnimationSound)) {
-           PlayUnitSound(unit, VoiceTreeChopping);
+           PlayUnitSound(unit, VoiceHarvesting);
        }
 #endif
     }
Index: stratagus/src/include/sound.h
diff -u stratagus/src/include/sound.h:1.47 stratagus/src/include/sound.h:1.48
--- stratagus/src/include/sound.h:1.47  Fri Oct 31 16:56:28 2003
+++ stratagus/src/include/sound.h       Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: sound.h,v 1.47 2003/10/31 21:56:28 jsalmon3 Exp $
+//     $Id: sound.h,v 1.48 2003/11/02 04:20:38 jsalmon3 Exp $
 
 #ifndef __SOUND_H__
 #define __SOUND_H__
@@ -57,7 +57,6 @@
     SoundConfig PlacementSuccess;      /// used by ui
     SoundConfig Click;                 /// used by ui
 
-    SoundConfig TreeChopping;          /// FIXME: currently unused
     SoundConfig Docking;               /// ship reaches coast
     SoundConfig BuildingConstruction;  /// building under construction
 
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.226 stratagus/src/include/unit.h:1.227
--- stratagus/src/include/unit.h:1.226  Sat Nov  1 06:33:09 2003
+++ stratagus/src/include/unit.h        Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.h,v 1.226 2003/11/01 11:33:09 pludov Exp $
+//     $Id: unit.h,v 1.227 2003/11/02 04:20:38 jsalmon3 Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -455,8 +455,8 @@
     VoiceWorkCompleted,                        /// only worker, work completed
     VoiceBuilding,                     /// only for building under construction
     VoiceDocking,                      /// only for transport reaching coast
-    VoiceTreeChopping,                 /// only worker tree chopping
     VoiceRepairing,                    /// repairing
+    VoiceHarvesting,                   /// harvesting
 } UnitVoiceGroup;
 
 /**
Index: stratagus/src/include/unitsound.h
diff -u stratagus/src/include/unitsound.h:1.18 
stratagus/src/include/unitsound.h:1.19
--- stratagus/src/include/unitsound.h:1.18      Fri Oct 31 01:18:56 2003
+++ stratagus/src/include/unitsound.h   Sat Nov  1 23:20:38 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unitsound.h,v 1.18 2003/10/31 06:18:56 jsalmon3 Exp $
+//     $Id: unitsound.h,v 1.19 2003/11/02 04:20:38 jsalmon3 Exp $
 
 #ifndef __UNITSOUND_H__
 #define __UNITSOUND_H__
@@ -39,6 +39,7 @@
 ----------------------------------------------------------------------------*/
 
 #include "sound_id.h"
+#include "upgrade_structs.h"
 
 /*----------------------------------------------------------------------------
 --     Declarations
@@ -62,6 +63,7 @@
     SoundConfig        Acknowledgement;        /// acknowledge of use command
     SoundConfig        Ready;                  /// unit training... ready
     SoundConfig        Repair;                 /// unit repairing
+    SoundConfig        Harvest[MaxCosts];      /// unit harvesting
     SoundConfig        Help;                   /// unit is attacked
     SoundConfig        Dead;                   /// unit is killed
 } UnitSound;
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.126 
stratagus/src/include/unittype.h:1.127
--- stratagus/src/include/unittype.h:1.126      Fri Oct 31 01:18:56 2003
+++ stratagus/src/include/unittype.h    Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.126 2003/10/31 06:18:56 jsalmon3 Exp $
+//     $Id: unittype.h,v 1.127 2003/11/02 04:20:38 jsalmon3 Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -591,6 +591,7 @@
     Animation* Move;                   /// Unit moving
     Animation* Attack;                 /// Unit attacking/working
     Animation* Repair;                 /// Unit repairing
+    Animation* Harvest[MaxCosts];      /// Unit harvesting
     Animation* Die;                    /// Unit dieing
     Animation**        Extend;                 /// For future extensions
 } Animations;
Index: stratagus/src/sound/sound.c
diff -u stratagus/src/sound/sound.c:1.44 stratagus/src/sound/sound.c:1.45
--- stratagus/src/sound/sound.c:1.44    Fri Oct 31 01:18:56 2003
+++ stratagus/src/sound/sound.c Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: sound.c,v 1.44 2003/10/31 06:18:56 jsalmon3 Exp $
+//     $Id: sound.c,v 1.45 2003/11/02 04:20:38 jsalmon3 Exp $
 
 //@{
 
@@ -78,7 +78,6 @@
     { "placement error", NULL },
     { "placement success", NULL },
     { "click", NULL },
-    { "tree chopping", NULL },
     { "transport docking", NULL },
     { "building construction", NULL },
     {  { "basic human voices work complete", NULL },
@@ -176,8 +175,6 @@
            return unit->Type->Sound.Help.Sound;
        case VoiceDying:
            return unit->Type->Sound.Dead.Sound;
-       case VoiceTreeChopping:
-           return GameSounds.TreeChopping.Sound;
        case VoiceWorkCompleted:
            return GameSounds.WorkComplete[ThisPlayer->Race].Sound;
        case VoiceBuilding:
@@ -186,6 +183,8 @@
            return GameSounds.Docking.Sound;
        case VoiceRepairing:
            return unit->Type->Sound.Repair.Sound;
+       case VoiceHarvesting:
+           return unit->Type->Sound.Harvest[unit->CurrentResource].Sound;
     }
     return NULL;
 }
@@ -313,10 +312,6 @@
     }
     if (!GameSounds.Click.Sound) {
        GameSounds.Click.Sound = SoundIdForName(GameSounds.Click.Name);
-    }
-    if (!GameSounds.TreeChopping.Sound) {
-       GameSounds.TreeChopping.Sound =
-           SoundIdForName(GameSounds.TreeChopping.Name);
     }
     if (!GameSounds.Docking.Sound) {
        GameSounds.Docking.Sound =
Index: stratagus/src/sound/unitsound.c
diff -u stratagus/src/sound/unitsound.c:1.24 
stratagus/src/sound/unitsound.c:1.25
--- stratagus/src/sound/unitsound.c:1.24        Fri Oct 31 01:18:56 2003
+++ stratagus/src/sound/unitsound.c     Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unitsound.c,v 1.24 2003/10/31 06:18:56 jsalmon3 Exp $
+//     $Id: unitsound.c,v 1.25 2003/11/02 04:20:38 jsalmon3 Exp $
 
 //@{
 
@@ -257,6 +257,7 @@
 {
     UnitType* type;
     int i;
+    int j;
 
     if (SoundFildes != -1) {
        SetSoundRange(SoundIdForName("tree chopping"), 32);
@@ -289,6 +290,12 @@
            if (type->Sound.Repair.Name) {
                type->Sound.Repair.Sound =
                    SoundIdForName(type->Sound.Repair.Name);
+           }
+           for (j = 0; j < MaxCosts; ++j) {
+               if (type->Sound.Harvest[j].Name) {
+                   type->Sound.Harvest[j].Sound =
+                       SoundIdForName(type->Sound.Harvest[j].Name);
+               }
            }
            // FIXME: will be modified, attack sound be moved to missile/weapon
            if (type->Weapon.Attack.Name) {
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.105 
stratagus/src/unit/ccl_unittype.c:1.106
--- stratagus/src/unit/ccl_unittype.c:1.105     Fri Oct 31 01:51:06 2003
+++ stratagus/src/unit/ccl_unittype.c   Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.105 2003/10/31 06:51:06 jsalmon3 Exp $
+//     $Id: ccl_unittype.c,v 1.106 2003/11/02 04:20:38 jsalmon3 Exp $
 
 //@{
 
@@ -602,6 +602,27 @@
                    type->Sound.Repair.Name = gh_scm2newstr(
                        gh_car(sublist), NULL);
                    sublist = gh_cdr(sublist);
+               } else if (gh_eq_p(value, gh_symbol2scm("harvest"))) {
+                   int res;
+                   char* name;
+
+                   name = gh_scm2newstr(gh_car(sublist), NULL);
+                   sublist = gh_cdr(sublist);
+                   for (res = 0; res < MaxCosts; ++res) {
+                       if (!strcmp(name, DefaultResourceNames[res])) {
+                           break;
+                       }
+                   }
+                   if (res == MaxCosts) {
+                       errl("Resource not found", value);
+                   }
+                   free(name);
+                   if (redefine) {
+                       free(type->Sound.Harvest[res].Name);
+                   }
+                   type->Sound.Harvest[res].Name = gh_scm2newstr(
+                       gh_car(sublist), NULL);
+                   sublist = gh_cdr(sublist);
                } else if (gh_eq_p(value, gh_symbol2scm("help"))) {
                    if (redefine) {
                        free(type->Sound.Help.Name);
@@ -972,6 +993,7 @@
     char* str;
     SCM id;
     SCM value;
+    SCM resource;
     Animations* anims;
     Animation* anim;
     Animation* t;
@@ -985,6 +1007,10 @@
     while (!gh_null_p(list)) {
        id = gh_car(list);
        list = gh_cdr(list);
+       if (gh_eq_p(id, gh_symbol2scm("harvest"))) {
+           resource = gh_car(list);
+           list = gh_cdr(list);
+       }
        value = gh_car(list);
        list = gh_cdr(list);
 
@@ -1025,6 +1051,24 @@
                free(anims->Repair);
            }
            anims->Repair = anim;
+       } else if (gh_eq_p(id, gh_symbol2scm("harvest"))) {
+           int res;
+           char* name;
+
+           name = gh_scm2newstr(resource, NULL);
+           for (res = 0; res < MaxCosts; ++res) {
+               if (!strcmp(name, DefaultResourceNames[res])) {
+                   break;
+               }
+           }
+           if (res == MaxCosts) {
+               errl("Resource not found", value);
+           }
+           free(name);
+           if (anims->Harvest[res]) {
+               free(anims->Harvest[res]);
+           }
+           anims->Harvest[res] = anim;
        } else if (gh_eq_p(id, gh_symbol2scm("die"))) {
            if (anims->Die) {
                free(anims->Die);
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.121 stratagus/src/unit/unittype.c:1.122
--- stratagus/src/unit/unittype.c:1.121 Fri Oct 31 01:18:56 2003
+++ stratagus/src/unit/unittype.c       Sat Nov  1 23:20:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.121 2003/10/31 06:18:56 jsalmon3 Exp $
+//     $Id: unittype.c,v 1.122 2003/11/02 04:20:38 jsalmon3 Exp $
 
 //@{
 
@@ -541,10 +541,12 @@
 **     Save state of an animition set to file.
 **
 **     @param name     Animation name.
+**     @param resname  Resource name.
 **     @param anim     Save this animation.
 **     @param file     Output file.
 */
-local void SaveAnimation(const char* name, const Animation* anim, CLFile* file)
+local void SaveAnimation(const char* name, const char* resname,
+    const Animation* anim, CLFile* file)
 {
     int i;
     int p;
@@ -567,7 +569,11 @@
            }
        }
 
-       CLprintf(file, "\n  '%s '(\t; #%d", name, i);
+       CLprintf(file, "\n  '%s ", name);
+       if (resname) {
+           CLprintf(file, "'%s ", resname);
+       }
+       CLprintf(file, "'(\t; #%d", i);
        if (p) {
            CLprintf(file, " P%d", p);
        }
@@ -604,7 +610,7 @@
 **     @param type     Save animations of this unit-type.
 **     @param file     Output file.
 */
-local void SaveAnimations(const UnitType* type,CLFile* file)
+local void SaveAnimations(const UnitType* type, CLFile* file)
 {
     const Animations* anims;
     int i;
@@ -639,10 +645,15 @@
     }
     CLprintf(file, "\n(define-animations 'animations-%s", type->Ident + 5);
 
-    SaveAnimation("still", anims->Still,file);
-    SaveAnimation("move", anims->Move,file);
-    SaveAnimation("attack", anims->Attack,file);
-    SaveAnimation("die", anims->Die,file);
+    SaveAnimation("still", NULL, anims->Still, file);
+    SaveAnimation("move", NULL, anims->Move, file);
+    SaveAnimation("attack", NULL, anims->Attack, file);
+    SaveAnimation("repair", NULL, anims->Repair, file);
+    for (i = 0; i < MaxCosts; ++i) {
+       SaveAnimation("harvest", DefaultResourceNames[i],
+           anims->Harvest[i], file);
+    }
+    SaveAnimation("die", NULL, anims->Die, file);
 
     CLprintf(file, ")\n");
 }
@@ -690,7 +701,7 @@
     //
     // Animations are shared, find first use of the unit-type animation.
     //
-    for (i = 0; i < NumUnitTypes && UnitTypes[i] != type ; ++i) {
+    for (i = 0; i < NumUnitTypes && UnitTypes[i] != type; ++i) {
        if (UnitTypes[i]->Animations == type->Animations) {
            break;
        }
@@ -1070,6 +1081,12 @@
     if (type->Sound.Repair.Name) {
        CLprintf(file, "\n    repair \"%s\"", type->Sound.Repair.Name);
     }
+    for (i = 0; i < MaxCosts; ++i) {
+       if (type->Sound.Harvest[i].Name) {
+           CLprintf(file, "\n    harvest %s \"%s\"", DefaultResourceNames[i],
+               type->Sound.Harvest[i].Name);
+       }
+    }
     if (type->Sound.Help.Name) {
        CLprintf(file, "\n    help \"%s\"", type->Sound.Help.Name);
     }
@@ -1171,7 +1188,7 @@
     char** sp;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.121 2003/10/31 
06:18:56 jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.122 2003/11/02 
04:20:38 jsalmon3 Exp $\n\n");
 
     // Original number to internal unit-type name.
 
@@ -1568,6 +1585,11 @@
        }
        if (type->Sound.Repair.Name) {
            free(type->Sound.Repair.Name);
+       }
+       for (j = 0; j < MaxCosts; ++j) {
+           if (type->Sound.Harvest[j].Name) {
+               free(type->Sound.Harvest[j].Name);
+           }
        }
        if (type->Sound.Help.Name) {
            free(type->Sound.Help.Name);




reply via email to

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