[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/map.h include/sound.h inc...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src include/map.h include/sound.h inc... |
Date: |
24 Dec 2003 11:35:26 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/24 11:35:25
Modified files:
src/include : map.h sound.h ui.h
src/map : map.c map_draw.c map_fog.c
src/stratagus : mainloop.c
src/ui : ccl_ui.c
Log message:
NEW_MAPDRAW updates, still doesn't work correctly. But It testable,
and developable.
All Redraw Info moved into Viewports
Patches:
Index: stratagus/src/include/map.h
diff -u stratagus/src/include/map.h:1.109 stratagus/src/include/map.h:1.110
--- stratagus/src/include/map.h:1.109 Mon Dec 22 15:09:46 2003
+++ stratagus/src/include/map.h Wed Dec 24 11:35:20 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map.h,v 1.109 2003/12/22 04:09:46 wizzard Exp $
+// $Id: map.h,v 1.110 2003/12/24 00:35:20 wizzard Exp $
#ifndef __MAP_H__
#define __MAP_H__
@@ -339,9 +339,6 @@
extern WorldMap TheMap; /// The current map
-extern char MustRedrawRow[MAXMAP_W]; /// Flags must redraw map row
-extern char MustRedrawTile[MAXMAP_W*MAXMAP_H]; /// Flags must redraw tile
-
/// Fast draw tile, display and video mode independ
#ifdef USE_SDL_SURFACE
extern void VideoDrawTile(const int, int, int);
@@ -435,7 +432,7 @@
extern void UpdateFogOfWarChange(void);
/// Draw the map fog of war
-extern void DrawMapFogOfWar(const Viewport* vp, int x, int y);
+extern void DrawMapFogOfWar(Viewport* vp, int x, int y);
/// Build tables for fog of war
extern void InitMapFogOfWar(void);
/// Cleanup memory for fog of war tables
Index: stratagus/src/include/sound.h
diff -u stratagus/src/include/sound.h:1.51 stratagus/src/include/sound.h:1.52
--- stratagus/src/include/sound.h:1.51 Sat Dec 20 16:33:28 2003
+++ stratagus/src/include/sound.h Wed Dec 24 11:35:20 2003
@@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
-// T H E W A R B E G I N S
-// Stratagus - A free fantasy real time strategy game engine
+// T H E W A R B E G I N S
+// Stratagus - A free fantasy real time strategy game engine
//
-/address@hidden sound.h - The sound header file. */
+/address@hidden sound.h - The sound header file. */
//
-// (c) Copyright 1998-2003 by Lutz Sammer and Fabrice Rossi
+// (c) Copyright 1998-2003 by Lutz Sammer and Fabrice Rossi
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,113 +26,119 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sound.h,v 1.51 2003/12/20 05:33:28 jsalmon3 Exp $
+// $Id: sound.h,v 1.52 2003/12/24 00:35:20 wizzard Exp $
#ifndef __SOUND_H__
#define __SOUND_H__
//@{
-#ifdef WITH_SOUND // {
+#ifdef WITH_SOUND // {
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#include "sound_id.h"
#include "missile.h"
/*----------------------------------------------------------------------------
--- Definitons
+-- Definitons
----------------------------------------------------------------------------*/
-#define MaxSampleVolume 255 /// Maximum sample
volume
-#define NO_SOUND 0 /// No valid
sound ID
+#define MaxSampleVolume 255 /// Maximum sample volume
+#define NO_SOUND 0 /// No valid sound ID
/**
-** Global game sounds, not associated to any unit-type
+** Global game sounds, not associated to any unit-type
*/
typedef struct _game_sound_ {
- SoundConfig PlacementError; /// used by ui
- SoundConfig PlacementSuccess; /// used by ui
- SoundConfig Click; ///
used by ui
+ SoundConfig PlacementError; /// used by ui
+ SoundConfig PlacementSuccess; /// used by ui
+ SoundConfig Click; /// used by ui
- SoundConfig Docking; /// ship reaches coast
- SoundConfig BuildingConstruction; /// building under
construction
+ SoundConfig Docking; /// ship reaches coast
+ SoundConfig BuildingConstruction; /// building under construction
-//FIXME: (Fabrice) I don't think it's the correct place to put this
- SoundConfig WorkComplete[MAX_RACES];/// building ready
+ //FIXME: (Fabrice) I don't think it's the correct place to put this
+ SoundConfig WorkComplete[MAX_RACES]; /// building ready
- SoundConfig Rescue[MAX_RACES]; /// rescue units
+ SoundConfig Rescue[MAX_RACES]; /// rescue units
} GameSound;
typedef enum _play_section_type_ {
- PlaySectionUnknown = -1, /// Unknown
- PlaySectionGame, /// Game
- PlaySectionBriefing, /// Briefing
- PlaySectionStats, ///
Stats
- PlaySectionStatsVictory, /// Stats
Victory
- PlaySectionStatsDefeat, /// Stats Defeat
- PlaySectionMainMenu, /// Main menu
+ PlaySectionUnknown = -1, /// Unknown
+ PlaySectionGame, /// Game
+ PlaySectionBriefing, /// Briefing
+ PlaySectionStats, /// Stats
+ PlaySectionStatsVictory, /// Stats Victory
+ PlaySectionStatsDefeat, /// Stats Defeat
+ PlaySectionMainMenu, /// Main menu
} PlaySectionType;
typedef enum _play_section_order_ {
- PlaySectionOrderAll, /// Sequential order
- PlaySectionOrderRandom, /// Random order
+ PlaySectionOrderAll, /// Sequential order
+ PlaySectionOrderRandom, /// Random order
} PlaySectionOrder;
typedef struct _play_section_ {
- char *Race;
/// Race, NULL if for all races
- PlaySectionType Type; /// Type
- unsigned long CDTracks; /// Bit field of cd
tracks. 32 enough?
- PlaySectionOrder CDOrder; /// CD order
- char **Files; /// Files
- PlaySectionOrder FileOrder; /// File order
+ char* Race; /// Race, NULL if for all races
+ PlaySectionType Type; /// Type
+ unsigned long CDTracks; /// Bit field of cd tracks. 32 enough?
+ PlaySectionOrder CDOrder; /// CD order
+ char** Files; /// Files
+ PlaySectionOrder FileOrder; /// File order
} PlaySection;
/*----------------------------------------------------------------------------
--- Variables
+-- Variables
----------------------------------------------------------------------------*/
- /**
- ** Client side sound control. Can be used to turn on/off
sound without
- ** really turning it off on the server side.
- */
+/**
+** Client side sound control. Can be used to turn on/off sound without
+** really turning it off on the server side.
+*/
extern int SoundOff;
-extern int MusicOff; /// Music
turned off
+extern int MusicOff; /// Music turned off
-extern GameSound GameSounds; /// Game sound
configuration
+extern GameSound GameSounds; /// Game sound configuration
-extern int PlayingMusic; /// flag true if
playing music
-extern int CallbackMusic; /// flag true callback
ccl if stops
+extern int PlayingMusic; /// flag true if playing music
+extern int CallbackMusic; /// flag true callback ccl if stops
-extern PlaySection *PlaySections; /// Play sections
-extern int NumPlaySections; /// Number of play
sections
+extern PlaySection* PlaySections; /// Play sections
+extern int NumPlaySections; /// Number of play sections
extern PlaySectionType CurrentPlaySection; /// Current play section type
extern char* CurrentMusicFile;
/*----------------------------------------------------------------------------
--- Functions
+-- Functions
----------------------------------------------------------------------------*/
-/** Ask to the sound server to play a sound attached to an unit. The
- sound server may discard the sound if needed (e.g., when the same
- unit is already speaking).
- @param unit the unit speaking
- @param unit_voice_group the sound to play
+/**
+** Ask to the sound server to play a sound attached to an unit. The
+** sound server may discard the sound if needed (e.g., when the same
+** Unit is already speaking).
+**
+** @param unit the unit speaking
+** @param unit_voice_group the sound to play
*/
extern void PlayUnitSound(const Unit* unit,UnitVoiceGroup unit_voice_group);
-/** Ask to the sound server to play a sound associated to a missile.
- @param missile the missile (origin of the sound)
- @param sound the sound to play
+/**
+** Ask to the sound server to play a sound associated to a missile.
+**
+** @param missile the missile (origin of the sound)
+** @param sound the sound to play
*/
extern void PlayMissileSound(const Missile* missile,SoundId sound);
-/** Ask to the sound server to play a sound: low level call.
- @param sound the sound to play.
- @param volume volume of the sound
+/**
+** Ask to the sound server to play a sound: low level call.
+**
+** @param sound the sound to play.
+** @param volume volume of the sound
*/
extern void PlayGameSound(SoundId sound,unsigned char volume);
@@ -141,7 +147,8 @@
/// Set music volume
extern void SetMusicVolume(int volume);
-/** Initialize client side of the sound layer.
+/**
+** Initialize client side of the sound layer.
*/
extern void InitSoundClient(void);
@@ -156,37 +163,37 @@
/// Turn music stopped callback on
#define CallbackMusicOn() \
- CallbackMusic=1;
+ CallbackMusic=1;
/// Turn music stopped callback off
#define CallbackMusicOff() \
- CallbackMusic=0;
+ CallbackMusic=0;
-#else // }{ WITH_SOUND
+#else // }{ WITH_SOUND
/*----------------------------------------------------------------------------
--- Definitons
+-- Definitons
----------------------------------------------------------------------------*/
-#define SoundOff 1 /// Dummy macro
for without sound
-#define PlayingMusic 1 /// Dummy macro
for without sound
-#define CurrentMusicFile "" /// Dummy macro for
without sound
-
-#define PlayUnitSound(u,g) /// Dummy macro for
without sound
-#define PlayMissileSound(s,v) /// Dummy macro for
without sound
-#define PlayGameSound(s,v) /// Dummy macro for
without sound
-#define SetGlobalVolume(v) /// Dummy macro for
without sound
-#define SetMusicVolume(v) /// Dummy macro for
without sound
-#define InitSoundClient() /// Dummy macro for
without sound
-
-#define PlayFile(v) /// Dummy macro
for without sound
-#define PlayMusic(v) 0 /// Dummy macro
for without sound
-#define StopMusic() /// Dummy macro
for without sound
-#define CallbackMusicOn() /// Dummy macro for
without sound
-#define CallbackMusicOff() /// Dummy macro for
without sound
-#define PlaySectionMusic(v) /// Dummy macro for
without sound
+#define SoundOff 1 /// Dummy macro for without sound
+#define PlayingMusic 1 /// Dummy macro for without sound
+#define CurrentMusicFile "" /// Dummy macro for without sound
+
+#define PlayUnitSound(u,g) /// Dummy macro for without sound
+#define PlayMissileSound(s,v) /// Dummy macro for without sound
+#define PlayGameSound(s,v) /// Dummy macro for without sound
+#define SetGlobalVolume(v) /// Dummy macro for without sound
+#define SetMusicVolume(v) /// Dummy macro for without sound
+#define InitSoundClient() /// Dummy macro for without sound
+
+#define PlayFile(v) /// Dummy macro for without sound
+#define PlayMusic(v) 0 /// Dummy macro for without sound
+#define StopMusic() /// Dummy macro for without sound
+#define CallbackMusicOn() /// Dummy macro for without sound
+#define CallbackMusicOff() /// Dummy macro for without sound
+#define PlaySectionMusic(v) /// Dummy macro for without sound
-#endif // } WITH_SOUND
+#endif // } WITH_SOUND
//@}
-#endif // !__SOUND_H__
+#endif // !__SOUND_H__
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.82 stratagus/src/include/ui.h:1.83
--- stratagus/src/include/ui.h:1.82 Sat Dec 20 16:33:28 2003
+++ stratagus/src/include/ui.h Wed Dec 24 11:35:20 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.82 2003/12/20 05:33:28 jsalmon3 Exp $
+// $Id: ui.h,v 1.83 2003/12/24 00:35:20 wizzard Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -99,6 +99,9 @@
int MapY; /// Map tile
upper corner y coordinate
int MapWidth; /// Width in map tiles
int MapHeight; /// Height in map tiles
+
+ char MustRedrawTile[MAXMAP_W * MAXMAP_H];
+ char MustRedrawRow[MAXMAP_W];
Unit* Unit; /// Bound to
this unit
};
Index: stratagus/src/map/map.c
diff -u stratagus/src/map/map.c:1.70 stratagus/src/map/map.c:1.71
--- stratagus/src/map/map.c:1.70 Sat Dec 20 16:33:30 2003
+++ stratagus/src/map/map.c Wed Dec 24 11:35:21 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map.c,v 1.70 2003/12/20 05:33:30 jsalmon3 Exp $
+// $Id: map.c,v 1.71 2003/12/24 00:35:21 wizzard Exp $
//@{
@@ -79,6 +79,8 @@
// Nothing changed? Seeing already the correct tile.
//
if ((tile = mf->Tile) == (seentile = mf->SeenTile)) {
+ // FIXME: Check bounds
+ MarkDrawAreaMap(x - 1, y - 1, x + 1, y + 1);
return;
}
mf->SeenTile = tile;
Index: stratagus/src/map/map_draw.c
diff -u stratagus/src/map/map_draw.c:1.56 stratagus/src/map/map_draw.c:1.57
--- stratagus/src/map/map_draw.c:1.56 Sat Dec 20 16:33:30 2003
+++ stratagus/src/map/map_draw.c Wed Dec 24 11:35:21 2003
@@ -29,7 +29,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_draw.c,v 1.56 2003/12/20 05:33:30 jsalmon3 Exp $
+// $Id: map_draw.c,v 1.57 2003/12/24 00:35:21 wizzard Exp $
//@{
@@ -162,22 +162,6 @@
local unsigned int PixelsHigh[256];
/**
-** Flags must redraw map row.
-** MustRedrawRow[y]!=0 This line of tiles must be redrawn.
-**
-** @see MAXMAP_W
-*/
-global char MustRedrawRow[MAXMAP_W];
-
-/**
-** Flags must redraw tile.
-** MustRedrawRow[x + y * ::MapWidth] != 0 This tile must be
redrawn.
-**
-** @see MAXMAP_W @see MAXMAP_H
-*/
-global char MustRedrawTile[MAXMAP_W * MAXMAP_H];
-
-/**
** Fast draw tile function pointer.
**
** Draws tiles display and video mode independ
@@ -2581,8 +2565,14 @@
*/
global int MarkDrawPosMap(int x, int y)
{
- if (MapTileGetViewport(x, y)) {
+ Viewport *vp;
+
+ if ((vp = MapTileGetViewport(x, y))) {
MustRedraw |= RedrawMap;
+#if NEW_MAPDRAW
+ vp->MustRedrawRow[y - vp->MapY] = 1;
+ vp->MustRedrawTile[x - vp->MapX + (y - vp->MapY) *
vp->MapWidth] = 1;
+#endif
return 1;
}
return 0;
@@ -2657,9 +2647,26 @@
*/
global int MarkDrawAreaMap(int sx, int sy, int ex, int ey)
{
+#ifdef NEW_MAPDRAW
+ int i;
+ int j;
+ Viewport* vp;
+#endif
+
if (MapTileGetViewport(sx, sy) || MapTileGetViewport(ex, ey) ||
MapTileGetViewport(sx, ey) || MapTileGetViewport(ex,
sy)) {
MustRedraw |= RedrawMap;
+#ifdef NEW_MAPDRAW
+ if ((vp = MapTileGetViewport(sx, sy))) {
+ for (i = sy - vp->MapY; i <= ey - vp->MapY && i <
vp->MapHeight; ++i) {
+ vp->MustRedrawRow[i] = 1;
+ // FIXME: Add Only needed tiles
+ for (j = 0; j < vp->MapWidth; ++j) {
+ vp->MustRedrawTile[i * vp->MapWidth + j] = 1;
+ }
+ }
+ }
+#endif
return 1;
}
return 0;
@@ -2676,12 +2683,16 @@
DebugLevel3Fn("\n");
#ifdef NEW_MAPDRAW
int i;
+ int x;
+ int y;
- for (i = 0; i < TheMap.Height; ++i) {
- MustRedrawRow[i] = 1;
- }
- for (i = 0; i < TheMap.Height * TheMap.Width; ++i) {
- MustRedrawTile[i] = 1;
+ for (i = 0; i < TheUI.NumViewports; ++i) {
+ for (y = 0; y < TheUI.Viewports[i].MapHeight; ++y) {
+ TheUI.Viewports[i].MustRedrawRow[y] = 1;
+ for (x = 0; x < TheUI.Viewports[i].MapWidth; ++x) {
+ TheUI.Viewports[i].MustRedrawTile[x + y *
TheUI.Viewports[i].MapWidth] = 1;
+ }
+ }
}
#endif
@@ -2747,8 +2758,8 @@
memset(TileCached, 0, sizeof(TileCached));
#endif
- redraw_row = MustRedrawRow; // flags must
redraw or not
- redraw_tile = MustRedrawTile;
+ redraw_row = vp->MustRedrawRow; // flags must
redraw or not
+ redraw_tile = vp->MustRedrawTile;
ex = vp->EndX;
sy = y * TheMap.Width;
@@ -2772,15 +2783,24 @@
}
// StephanR: debug-mode denote tiles that are
redrawn
-#if NEW_MAPDRAW > 1
- VideoDrawRectangle(redraw_tile[-1] > 1
? ColorWhite : ColorRed,
- dx, dy, 32, 32);
-#endif
}
+#ifdef NEW_MAPDRAW_
+ VideoDrawRectangle(redraw_tile[-1] == 1 ?
ColorWhite : ColorRed,
+ dx, dy, 32, 32);
+#endif
++sx;
dx += TileSizeX;
}
} else {
+#ifdef NEW_MAPDRAW_
+ sx = x + sy;
+ dx = vp->X;
+ while (dx < ex) {
+ VideoDrawRectangle(ColorRed, dx, dy, 32, 32);
+ ++sx;
+ dx += TileSizeX;
+ }
+#endif
redraw_tile += vp->MapWidth;
}
sy += TheMap.Width;
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.133 stratagus/src/map/map_fog.c:1.134
--- stratagus/src/map/map_fog.c:1.133 Sat Dec 20 16:33:31 2003
+++ stratagus/src/map/map_fog.c Wed Dec 24 11:35:21 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.133 2003/12/20 05:33:31 jsalmon3 Exp $
+// $Id: map_fog.c,v 1.134 2003/12/24 00:35:21 wizzard Exp $
//@{
@@ -2901,7 +2901,7 @@
** @param x Map viewpoint x position.
** @param y Map viewpoint y position.
*/
-global void DrawMapFogOfWar(const Viewport* vp, int x, int y)
+global void DrawMapFogOfWar(Viewport* vp, int x, int y)
{
int sx;
int sy;
@@ -2921,8 +2921,8 @@
static long mv = 9999999;
#endif
- redraw_row = MustRedrawRow; // flags must
redraw or not
- redraw_tile = MustRedrawTile;
+ redraw_row = vp->MustRedrawRow; // flags must
redraw or not
+ redraw_tile = vp->MustRedrawTile;
p = ThisPlayer->Player;
Index: stratagus/src/stratagus/mainloop.c
diff -u stratagus/src/stratagus/mainloop.c:1.172
stratagus/src/stratagus/mainloop.c:1.173
--- stratagus/src/stratagus/mainloop.c:1.172 Tue Dec 23 11:12:57 2003
+++ stratagus/src/stratagus/mainloop.c Wed Dec 24 11:35:23 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.172 2003/12/23 00:12:57 jsalmon3 Exp $
+// $Id: mainloop.c,v 1.173 2003/12/24 00:35:23 wizzard Exp $
//@{
@@ -386,17 +386,19 @@
if (InterfaceState == IfaceStateNormal) {
#ifdef NEW_MAPDRAW
+#if 0
MapUpdateFogOfWar(vp->MapX, vp->MapY);
+#endif
#else
int u;
// FIXME: Johns: this didn't work correct with viewports!
// FIXME: only needed until flags are correct set
for (u = 0; u < vp->MapHeight; ++u) {
- MustRedrawRow[u] = 1;
+ vp->MustRedrawRow[u] = 1;
}
for (u = 0; u < vp->MapHeight * vp->MapWidth; ++u) {
- MustRedrawTile[u] = 1;
+ vp->MustRedrawTile[u] = 1;
}
#endif
//
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.176 stratagus/src/ui/ccl_ui.c:1.177
--- stratagus/src/ui/ccl_ui.c:1.176 Tue Dec 23 16:30:16 2003
+++ stratagus/src/ui/ccl_ui.c Wed Dec 24 11:35:23 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.176 2003/12/23 05:30:16 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.177 2003/12/24 00:35:23 wizzard Exp $
//@{
@@ -604,16 +604,16 @@
labelvalue =
gh_cdr(labelvalue);
poslist =
gh_car(labelvalue);
labelvalue =
gh_cdr(labelvalue);
-
TitleScreens[i]->Labels[j]->xofs = gh_scm2int(gh_car(poslist));
+
TitleScreens[i]->Labels[j]->Xofs = gh_scm2int(gh_car(poslist));
poslist =
gh_cdr(poslist);
-
TitleScreens[i]->Labels[j]->yofs = gh_scm2int(gh_car(poslist));
+
TitleScreens[i]->Labels[j]->Yofs = gh_scm2int(gh_car(poslist));
} else if
(gh_eq_p(gh_car(labelvalue), gh_symbol2scm("flags"))) {
labelvalue =
gh_cdr(labelvalue);
flagslist =
gh_car(labelvalue);
labelvalue =
gh_cdr(labelvalue);
while
(!gh_null_p(flagslist)) {
if
(gh_eq_p(gh_car(flagslist), gh_symbol2scm("center"))) {
-
TitleScreens[i]->Labels[j]->flags |= TitleFlagCenter;
+
TitleScreens[i]->Labels[j]->Flags |= TitleFlagCenter;
flagslist = gh_cdr(flagslist);
} else {
s1 = gh_scm2newstr(gh_car(flagslist), NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/map.h include/sound.h inc...,
address@hidden <=