[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src clone/clone.c include/stratagus.h...
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src clone/clone.c include/stratagus.h... |
Date: |
Fri, 17 Oct 2003 14:46:48 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/17 14:46:48
Modified files:
src/clone : clone.c
src/include : stratagus.h
src/movie : movie.c
src/ui : ccl_ui.c
Log message:
Allow more than one title screen
Patches:
Index: stratagus/src/clone/clone.c
diff -u stratagus/src/clone/clone.c:1.214 stratagus/src/clone/clone.c:1.215
--- stratagus/src/clone/clone.c:1.214 Thu Oct 16 13:03:01 2003
+++ stratagus/src/clone/clone.c Fri Oct 17 14:46:47 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: clone.c,v 1.214 2003/10/16 17:03:01 jsalmon3 Exp $
+// $Id: clone.c,v 1.215 2003/10/17 18:46:47 jsalmon3 Exp $
//@{
@@ -234,7 +234,7 @@
-- Variables
----------------------------------------------------------------------------*/
-global char* TitleScreen; /// Titlescreen to show at startup
+global char** TitleScreen; /// Titlescreen 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
@@ -451,7 +451,15 @@
local void WaitCallbackKey(unsigned dummy __attribute__((unused)))
{
DebugLevel3Fn("Pressed %8x %8x\n" _C_ MouseButtons _C_ dummy);
- WaitNoEvent=0;
+ WaitNoEvent = 0;
+}
+
+/**
+** Callback for input.
+*/
+local void WaitCallbackKey1(unsigned dummy __attribute__((unused)))
+{
+ DebugLevel3Fn("Released %8x %8x\n" _C_ MouseButtons _C_ dummy);
}
/**
@@ -461,7 +469,7 @@
unsigned dummy2 __attribute__((unused)))
{
DebugLevel3Fn("Pressed %8x %8x %8x\n" _C_ MouseButtons _C_ dummy1 _C_
dummy2);
- WaitNoEvent=0;
+ WaitNoEvent = 0;
}
/**
@@ -470,8 +478,17 @@
local void WaitCallbackKey3(unsigned dummy1 __attribute__((unused)),
unsigned dummy2 __attribute__((unused)))
{
+ DebugLevel3Fn("Released %8x %8x %8x\n" _C_ MouseButtons _C_ dummy1 _C_
dummy2);
+}
+
+/**
+** Callback for input.
+*/
+local void WaitCallbackKey4(unsigned dummy1 __attribute__((unused)),
+ unsigned dummy2 __attribute__((unused)))
+{
DebugLevel3Fn("Repeated %8x %8x %8x\n" _C_ MouseButtons _C_ dummy1 _C_
dummy2);
- WaitNoEvent=0;
+ WaitNoEvent = 0;
}
/**
@@ -856,7 +873,7 @@
}
#endif
-#ifdef DEBUG
+#ifdef DEBUG_DRAWFONTS
/**
** Draw the fonts, for screen shots.
*/
@@ -911,65 +928,52 @@
local void WaitForInput(int timeout)
{
EventCallback callbacks;
-#if defined(linux) && !defined(DEBUG)
- char* s;
- char ddate[72 + 1];
- FILE* ddfile;
-#endif
SetVideoSync();
callbacks.ButtonPressed = WaitCallbackKey;
- callbacks.ButtonReleased = WaitCallbackKey;
+ callbacks.ButtonReleased = WaitCallbackKey1;
callbacks.MouseMoved = WaitCallbackMouse;
callbacks.MouseExit = WaitCallbackExit;
callbacks.KeyPressed = WaitCallbackKey2;
- callbacks.KeyReleased = WaitCallbackKey2;
- callbacks.KeyRepeated = WaitCallbackKey3;
+ callbacks.KeyReleased = WaitCallbackKey3;
+ callbacks.KeyRepeated = WaitCallbackKey4;
callbacks.NetworkEvent = NetworkEvent;
callbacks.SoundReady = WriteSound;
//
// FIXME: more work needed, scrolling credits, animations, ...
-#ifdef DEBUG
WaitNoEvent = 1;
+#ifdef DEBUG_DRAWFONTS
while (WaitNoEvent) {
+ static int init = 0;
+ if (!init) {
+ SetDefaultTextColors(FontYellow, FontWhite);
+ LoadFonts();
+ init = 1;
+ }
DebugDrawFonts();
WaitEventsOneFrame(&callbacks);
}
#else
- VideoLockScreen();
- VideoDrawTextCentered(VideoWidth / 2, 5, LargeFont, "Press SPACE to
continue.");
-#ifdef linux
- ddate[0] = '\0';
- ddfile = popen("`which ddate`", "r");
- fgets(ddate, 72, ddfile);
- pclose(ddfile);
- if ((s = strrchr(ddate, '\n'))) {
- *s = '\0';
- }
- VideoDrawTextCentered(VideoWidth / 2, 20, LargeFont, ddate);
-#endif
- VideoUnlockScreen();
- Invalidate();
- RealizeVideoMemory();
-
- WaitNoEvent = 1;
timeout *= CYCLES_PER_SECOND;
while (timeout-- && WaitNoEvent) {
- VideoEffect0(timeout, &callbacks);
+ // FIXME: make this configurable
+ if (0) {
+ VideoEffect0(timeout, &callbacks);
+ }
WaitEventsOneFrame(&callbacks);
}
- VideoEffect0(-1, &callbacks);
+ if (0) {
+ VideoEffect0(-1, &callbacks);
+ }
#endif
VideoLockScreen();
- VideoDrawTextCentered(VideoWidth / 2, 5, LargeFont,
- "----------------------------");
+ VideoClearScreen();
VideoUnlockScreen();
Invalidate();
RealizeVideoMemory();
-
}
/**
@@ -1251,13 +1255,13 @@
//
InitVideo(); // setup video display
#ifdef WITH_SOUND
- if (!SoundOff && InitSound()) { // setup sound card
+ if (!SoundOff && InitSound()) { // setup sound card
SoundOff = 1;
SoundFildes = -1;
}
#endif
-#ifndef DEBUG // For debug its better not to have:
+#ifndef DEBUG // For debug it's better not to have:
srand(time(NULL)); // Random counter = random each start
#endif
@@ -1266,22 +1270,21 @@
//
// Show title screen.
//
- i = 1;
SetClipping(0, 0, VideoWidth - 1, VideoHeight - 1);
if (TitleScreen) {
- if ((i = PlayMovie(TitleScreen,
- PlayMovieZoomScreen | PlayMovieKeepAspect))) {
- DisplayPicture(TitleScreen);
- Invalidate();
+ for (i = 0; TitleScreen[i]; ++i) {
+ if (PlayMovie(TitleScreen[i],
+ PlayMovieZoomScreen | PlayMovieKeepAspect)) {
+ DisplayPicture(TitleScreen[i]);
+ Invalidate();
+ // FIXME: make the time configurable
+ WaitForInput(20);
+ }
}
}
InitUnitsMemory(); // Units memory management
PreMenuSetup(); // Load everything needed for menus
-
- if (i) {
- WaitForInput(20); // Show game intro
- }
MenuLoop(MapName, &TheMap); // Enter the menu loop
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.21
stratagus/src/include/stratagus.h:1.22
--- stratagus/src/include/stratagus.h:1.21 Thu Oct 16 13:03:01 2003
+++ stratagus/src/include/stratagus.h Fri Oct 17 14:46:47 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: stratagus.h,v 1.21 2003/10/16 17:03:01 jsalmon3 Exp $
+// $Id: stratagus.h,v 1.22 2003/10/17 18:46:47 jsalmon3 Exp $
#ifndef __STRATAGUS_H__
#define __STRATAGUS_H__
@@ -450,7 +450,7 @@
*/
#define MyRand() rand()
-extern char* TitleScreen; /// File for title screen
+extern char** TitleScreen; /// 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
Index: stratagus/src/movie/movie.c
diff -u stratagus/src/movie/movie.c:1.15 stratagus/src/movie/movie.c:1.16
--- stratagus/src/movie/movie.c:1.15 Mon Oct 13 22:20:22 2003
+++ stratagus/src/movie/movie.c Fri Oct 17 14:46:47 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: movie.c,v 1.15 2003/10/14 02:20:22 jsalmon3 Exp $
+// $Id: movie.c,v 1.16 2003/10/17 18:46:47 jsalmon3 Exp $
//@{
@@ -166,6 +166,13 @@
/**
** Callback for input.
*/
+local void MovieCallbackKey1(unsigned dummy __attribute__((unused)))
+{
+}
+
+/**
+** Callback for input.
+*/
local void MovieCallbackKey2(unsigned dummy1 __attribute__((unused)),
unsigned dummy2 __attribute__((unused)))
{
@@ -178,6 +185,14 @@
local void MovieCallbackKey3(unsigned dummy1 __attribute__((unused)),
unsigned dummy2 __attribute__((unused)))
{
+}
+
+/**
+** Callback for input.
+*/
+local void MovieCallbackKey4(unsigned dummy1 __attribute__((unused)),
+ unsigned dummy2 __attribute__((unused)))
+{
MovieKeyPressed = 0;
}
@@ -251,12 +266,12 @@
#endif
callbacks.ButtonPressed = MovieCallbackKey;
- callbacks.ButtonReleased = MovieCallbackKey;
+ callbacks.ButtonReleased = MovieCallbackKey1;
callbacks.MouseMoved = MovieCallbackMouse;
callbacks.MouseExit = MovieCallbackExit;
callbacks.KeyPressed = MovieCallbackKey2;
- callbacks.KeyReleased = MovieCallbackKey2;
- callbacks.KeyRepeated = MovieCallbackKey3;
+ callbacks.KeyReleased = MovieCallbackKey3;
+ callbacks.KeyRepeated = MovieCallbackKey4;
callbacks.NetworkEvent = NetworkEvent;
callbacks.SoundReady = WriteSound;
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.138 stratagus/src/ui/ccl_ui.c:1.139
--- stratagus/src/ui/ccl_ui.c:1.138 Thu Oct 16 21:23:09 2003
+++ stratagus/src/ui/ccl_ui.c Fri Oct 17 14:46:48 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.138 2003/10/17 01:23:09 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.139 2003/10/17 18:46:48 jsalmon3 Exp $
//@{
@@ -283,25 +283,26 @@
**
** @param title SCM title. (nil reports only)
**
-** @return Old title screen.
+** @return None
*/
-local SCM CclSetTitleScreen(SCM title)
+local SCM CclSetTitleScreen(SCM list)
{
- SCM old;
+ int i;
- old = NIL;
if (TitleScreen) {
- old = gh_str02scm(TitleScreen);
+ for (i = 0; TitleScreen[i]; ++i) {
+ free(TitleScreen[i]);
+ }
}
- if (!gh_null_p(title)) {
- if (TitleScreen) {
- free(TitleScreen);
- TitleScreen = NULL;
+ if (!gh_null_p(list)) {
+ i = 0;
+ TitleScreen = calloc(gh_length(list) + 1, sizeof(*TitleScreen));
+ while (!gh_null_p(list)) {
+ TitleScreen[i++] = gh_scm2newstr(gh_car(list), NULL);
+ list = gh_cdr(list);
}
-
- TitleScreen = gh_scm2newstr(title, NULL);
}
- return old;
+ return SCM_UNSPECIFIED;
}
/**
@@ -3240,7 +3241,7 @@
gh_new_procedure2_0("set-video-resolution!", CclSetVideoResolution);
gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullscreen);
- gh_new_procedure1_0("set-title-screen!", CclSetTitleScreen);
+ gh_new_procedureN("set-title-screen!", CclSetTitleScreen);
gh_new_procedure1_0("set-menu-background!", CclSetMenuBackground);
gh_new_procedure1_0("set-menu-background-with-title!",
CclSetMenuBackgroundWithTitle);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src clone/clone.c include/stratagus.h...,
Jimmy Salmon <=