stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/clone/clon...


From: Jimmy Salmon
Subject: [Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/clone/clon...
Date: Fri, 31 Oct 2003 17:16:59 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Jimmy Salmon <address@hidden>   03/10/31 17:16:58

Modified files:
        data/ccl       : stratagus.ccl 
        src/clone      : clone.c 
        src/include    : stratagus.h 
        src/ui         : ccl_ui.c ui.c 

Log message:
        Combined set-title-screen and set-title-music to set-title-screens

Patches:
Index: stratagus/data/ccl/stratagus.ccl
diff -u stratagus/data/ccl/stratagus.ccl:1.24 
stratagus/data/ccl/stratagus.ccl:1.25
--- stratagus/data/ccl/stratagus.ccl:1.24       Sun Oct 26 14:46:04 2003
+++ stratagus/data/ccl/stratagus.ccl    Fri Oct 31 17:16:54 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: stratagus.ccl,v 1.24 2003/10/26 19:46:04 n0body Exp $
+;;     $Id: stratagus.ccl,v 1.25 2003/10/31 22:16:54 jsalmon3 Exp $
 
 ;; For documentation see stratagus/doc/ccl/ccl.html
 
@@ -55,12 +55,10 @@
 ;(set-contrast! 110) (set-brightness! 15) (set-saturation! 100)
 
 ;;     Enter your default title screen.
-(set-title-screen! "graphics/ui/stratagus.png")
-;(set-title-screen! "graphics/logo_stratagus.avi")
-
-;;     Enter your title music.
-(set-title-music! "music/default.mod")
-;(set-title-music! "music/Matthew_T._Yankovich---_Twilight_March.ogg")
+(set-title-screens!
+  '("graphics/ui/stratagus.png" "music/default.mod")
+;  '("graphics/logo_stratagus.avi")
+)
 
 ;;     Enter your default menu background.
 (set-menu-background! "graphics/ui/Menu_background_without_title.png")
Index: stratagus/src/clone/clone.c
diff -u stratagus/src/clone/clone.c:1.218 stratagus/src/clone/clone.c:1.219
--- stratagus/src/clone/clone.c:1.218   Fri Oct 31 15:39:38 2003
+++ stratagus/src/clone/clone.c Fri Oct 31 17:16:55 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: clone.c,v 1.218 2003/10/31 20:39:38 jsalmon3 Exp $
+//     $Id: clone.c,v 1.219 2003/10/31 22:16:55 jsalmon3 Exp $
 
 //@{
 
@@ -234,10 +234,9 @@
 --     Variables
 ----------------------------------------------------------------------------*/
 
-global char** TitleScreen;             /// Titlescreen to show at startup
+global TitleScreen** TitleScreens;     /// Title screens to show at startup
 global char* MenuBackground;           /// File for menu background
 global char* MenuBackgroundWithTitle;  /// File for menu with title
-global char* TitleMusic;               /// File for title music
 global char* MenuMusic;                        /// File for menu music
 global char* StratagusLibPath;         /// Path for data directory
 global char LocalPlayerName[16];       /// Name of local player
@@ -1276,14 +1275,17 @@
     // Show title screen.
     //
     SetClipping(0, 0, VideoWidth - 1, VideoHeight - 1);
-    if (TitleScreen) {
-       for (i = 0; TitleScreen[i]; ++i) {
-           if (PlayMovie(TitleScreen[i],
-                   PlayMovieZoomScreen | PlayMovieKeepAspect)) {
-               if (!PlayingMusic && TitleMusic) {
-                   PlayMusic(TitleMusic);
+    if (TitleScreens) {
+       for (i = 0; TitleScreens[i]; ++i) {
+           if (TitleScreens[i]->Music) {
+               if (!strcmp(TitleScreens[i]->Music, "none") ||
+                       !PlayMusic(TitleScreens[i]->Music)) {
+                   StopMusic();
                }
-               DisplayPicture(TitleScreen[i]);
+           }
+           if (PlayMovie(TitleScreens[i]->File,
+                   PlayMovieZoomScreen | PlayMovieKeepAspect)) {
+               DisplayPicture(TitleScreens[i]->File);
                Invalidate();
                // FIXME: make the time configurable
                WaitForInput(20);
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.26 
stratagus/src/include/stratagus.h:1.27
--- stratagus/src/include/stratagus.h:1.26      Thu Oct 30 15:22:50 2003
+++ stratagus/src/include/stratagus.h   Fri Oct 31 17:16:57 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: stratagus.h,v 1.26 2003/10/30 20:22:50 n0body Exp $
+//     $Id: stratagus.h,v 1.27 2003/10/31 22:16:57 jsalmon3 Exp $
 
 #ifndef __STRATAGUS_H__
 #define __STRATAGUS_H__
@@ -444,11 +444,14 @@
     */
 #define MyRand()       rand()
 
-extern char** TitleScreen;             /// File for title screen
+typedef struct _title_screen_ {
+    char* File;
+    char* Music;
+} TitleScreen;
+extern TitleScreen** TitleScreens;     /// File for title screen
 extern char* GameName;                 /// Name of the game (wc2,wc1)
 extern char* MenuBackground;           /// File for menu background
 extern char* MenuBackgroundWithTitle;  /// File for menu with title
-extern char* TitleMusic;               /// File for title music
 extern char* MenuMusic;                        /// File for menu music
 extern char* ClickMissile;             /// Missile to show when you click
 extern char* DamageMissile;            /// Missile to show damage caused
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.143 stratagus/src/ui/ccl_ui.c:1.144
--- stratagus/src/ui/ccl_ui.c:1.143     Wed Oct 29 22:46:02 2003
+++ stratagus/src/ui/ccl_ui.c   Fri Oct 31 17:16:57 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_ui.c,v 1.143 2003/10/30 03:46:02 n0body Exp $
+//     $Id: ccl_ui.c,v 1.144 2003/10/31 22:16:57 jsalmon3 Exp $
 
 //@{
 
@@ -285,54 +285,39 @@
 **
 **     @return         None
 */
-local SCM CclSetTitleScreen(SCM list)
+local SCM CclSetTitleScreens(SCM list)
 {
     int i;
+    SCM value;
 
-    if (TitleScreen) {
-       for (i = 0; TitleScreen[i]; ++i) {
-           free(TitleScreen[i]);
-           TitleScreen[i]=NULL;
+    if (TitleScreens) {
+       for (i = 0; TitleScreens[i]; ++i) {
+           free(TitleScreens[i]->File);
+           free(TitleScreens[i]->Music);
+           free(TitleScreens[i]);
        }
+       free(TitleScreens);
+       TitleScreens = NULL;
     }
     if (!gh_null_p(list)) {
        i = 0;
-       TitleScreen = calloc(gh_length(list) + 1, sizeof(*TitleScreen));
+       TitleScreens = calloc(gh_length(list) + 1, sizeof(*TitleScreens));
        while (!gh_null_p(list)) {
-           TitleScreen[i++] = gh_scm2newstr(gh_car(list), NULL);
+           value = gh_car(list);
            list = gh_cdr(list);
+           TitleScreens[i] = calloc(1, sizeof(**TitleScreens));
+           TitleScreens[i]->File = gh_scm2newstr(gh_car(value), NULL);
+           value = gh_cdr(value);
+           if (!gh_null_p(value)) {
+               TitleScreens[i]->Music = gh_scm2newstr(gh_car(value), NULL);
+           }
+           ++i;
        }
     }
     return SCM_UNSPECIFIED;
 }
 
 /**
-**     Default title music.
-**
-**     @param music    title music. (nil reports only)
-**
-**     @return         Old title music.
-*/
-local SCM CclSetTitleMusic(SCM music)
-{
-    SCM old;
-
-    old = NIL;
-    if (TitleMusic) {
-       old = gh_str02scm(TitleMusic);
-    }
-    if (!gh_null_p(music)) {
-       if (TitleMusic) {
-           free(TitleMusic);
-           TitleMusic = NULL;
-       }
-
-       TitleMusic = gh_scm2newstr(music, NULL);
-    }
-    return old;
-}
-
-/**
 **     Default menu background.
 **
 **     @param background       background. (nil reports only)
@@ -3242,11 +3227,10 @@
     gh_new_procedure2_0("set-video-resolution!", CclSetVideoResolution);
     gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullscreen);
 
-    gh_new_procedureN("set-title-screen!", CclSetTitleScreen);
+    gh_new_procedureN("set-title-screens!", CclSetTitleScreens);
     gh_new_procedure1_0("set-menu-background!", CclSetMenuBackground);
     gh_new_procedure1_0("set-menu-background-with-title!",
        CclSetMenuBackgroundWithTitle);
-    gh_new_procedure1_0("set-title-music!", CclSetTitleMusic);
     gh_new_procedure1_0("set-menu-music!", CclSetMenuMusic);
 
     gh_new_procedure1_0("display-picture", CclDisplayPicture);
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.86 stratagus/src/ui/ui.c:1.87
--- stratagus/src/ui/ui.c:1.86  Fri Oct 24 23:12:17 2003
+++ stratagus/src/ui/ui.c       Fri Oct 31 17:16:58 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ui.c,v 1.86 2003/10/25 03:12:17 n0body Exp $
+//     $Id: ui.c,v 1.87 2003/10/31 22:16:58 jsalmon3 Exp $
 
 //@{
 
@@ -644,7 +644,7 @@
     int i;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.86 2003/10/25 03:12:17 n0body 
Exp $\n\n");
+    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.87 2003/10/31 22:16:58 
jsalmon3 Exp $\n\n");
 
     // Contrast, Brightness, Saturation
     CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);
@@ -809,11 +809,14 @@
     }
 
     // Free Title screen.
-    if (TitleScreen) {
-       for (i = 0; TitleScreen[i]; ++i) {
-           free(TitleScreen[i]);
-           TitleScreen[i]=NULL;
+    if (TitleScreens) {
+       for (i = 0; TitleScreens[i]; ++i) {
+           free(TitleScreens[i]->File);
+           free(TitleScreens[i]->Music);
+           free(TitleScreens[i]);
        }
+       free(TitleScreens);
+       TitleScreens = NULL;
     }
 
     // FIXME: Johns: Implement this correctly or we will lose memory!




reply via email to

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