[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus doc/ChangeLog.html doc/ccl/ui.html sr...
From: |
Martin Renold |
Subject: |
[Stratagus-CVS] stratagus doc/ChangeLog.html doc/ccl/ui.html sr... |
Date: |
Mon, 06 Oct 2003 16:54:16 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Martin Renold <address@hidden> 03/10/06 16:54:15
Modified files:
doc : ChangeLog.html
doc/ccl : ui.html
src/include : ui.h
src/map : minimap.c
src/ui : ccl_ui.c ui.c
Log message:
transparent minimap for undiscovered regions; fixed bug where AiHelpMe
gets called only once
Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.547 stratagus/doc/ChangeLog.html:1.548
--- stratagus/doc/ChangeLog.html:1.547 Thu Oct 2 23:03:09 2003
+++ stratagus/doc/ChangeLog.html Mon Oct 6 16:54:14 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.547 2003/10/03 03:03:09 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.548 2003/10/06 20:54:14 martinxyz Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
+ <li>Allowing minimap transparency for undiscovered areas. (from Martin
Renold).
<li>Fixed Sync bug, qsort must return a unique answer, regardless of sort
order (from Russell Smith and Jimmy Salmon).
<li>Implemented task #2634: Removed Hard Coded Burning (from Jimmy Salmon).
<li>Removed Mana 255 Limitation (from Russell Smith).
Index: stratagus/doc/ccl/ui.html
diff -u stratagus/doc/ccl/ui.html:1.16 stratagus/doc/ccl/ui.html:1.17
--- stratagus/doc/ccl/ui.html:1.16 Sun Sep 14 07:51:33 2003
+++ stratagus/doc/ccl/ui.html Mon Oct 6 16:54:14 2003
@@ -1069,20 +1069,21 @@
minimapx (+ minimapy 148))
</pre>
</dd>
-<dt>minimap-panel</dt>
+<dt>minimap</dt>
<dd>
<pre>
- 'minimap-panel (list
- (string-append "graphics/ui/" race "/minimap.png")
- minimapx minimapy)
-</pre>
-</dd>
-<dt>minimap-pos</dt>
-<dd>
-<pre>
- 'minimap-pos (list
- (+ minimapx 27) (+ minimapy 13))
-</pre>
+ 'minimap (list
+ 'file (string-append "graphics/ui/" race "/minimap.png")
+ 'panel-pos (list minimapx minimapy)
+ 'pos (list (+ minimapx 27) (+ minimapy 13))
+ 'size '(128 128)
+ 'transparent)
+</pre>
+There is a minimap panel an the minimap on it. The panel graphic has
+certain palette restrictions (FIXME: exactly? probably the same as the
+tileset?). Pos is the absoloute position of the minimap on the screen
+(the upper left corner of it). If you give 'transparent, the panel
+graphic will be displayed on unexplored terrain, black otherwise.
</dd>
<dt>status-line</dt>
<dd>
@@ -1292,7 +1293,7 @@
<h4>Not Used</h4>
<hr>
-Last changed: $Id: ui.html,v 1.16 2003/09/14 11:51:33 martinxyz Exp $<br>
+Last changed: $Id: ui.html,v 1.17 2003/10/06 20:54:14 martinxyz Exp $<br>
All trademarks and copyrights on this page are owned by their respective
owners.
<address>(c) 2002-2003 by <a href="http://stratagus.org">
The Stratagus Project</a></address></body></html>
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.67 stratagus/src/include/ui.h:1.68
--- stratagus/src/include/ui.h:1.67 Sat Oct 4 01:26:49 2003
+++ stratagus/src/include/ui.h Mon Oct 6 16:54:14 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.67 2003/10/04 05:26:49 jsalmon3 Exp $
+// $Id: ui.h,v 1.68 2003/10/06 20:54:14 martinxyz Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -265,6 +265,7 @@
int MinimapH; /// minimap screen Height
int MinimapPosX; /// minimap screen X position
int MinimapPosY; /// minimap screen Y position
+ int MinimapTransparent; /// unexplored areas are
transparent
int ViewportCursorColor; /// minimap cursor color
// The status line
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.67 stratagus/src/map/minimap.c:1.68
--- stratagus/src/map/minimap.c:1.67 Sat Oct 4 01:26:50 2003
+++ stratagus/src/map/minimap.c Mon Oct 6 16:54:15 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: minimap.c,v 1.67 2003/10/04 05:26:50 jsalmon3 Exp $
+// $Id: minimap.c,v 1.68 2003/10/06 20:54:15 martinxyz Exp $
//@{
@@ -175,6 +175,8 @@
global void CreateMinimap(void)
{
int n;
+ int x;
+ int y;
if (TheMap.Width > TheMap.Height) { // Scale to biggest value.
n = TheMap.Width;
@@ -215,7 +217,24 @@
memset(MinimapTerrainGraphic->Frames, 0, TheUI.MinimapW * TheUI.MinimapH);
MinimapGraphic = NewGraphic(8, TheUI.MinimapW, TheUI.MinimapH);
MinimapGraphic->Pixels = VideoCreateNewPalette(GlobalPalette);
- memset(MinimapGraphic->Frames, 0, TheUI.MinimapW * TheUI.MinimapH);
+
+ // FIXME: looks too complicated
+ for (y = 0; y < TheUI.MinimapH; ++y) {
+ for (x = 0; x < TheUI.MinimapW; ++x) {
+ // this only copies the panel background... honest.
+ ((unsigned char*)MinimapGraphic->Frames)[x + y * TheUI.MinimapW] =
+ ((unsigned
char*)TheUI.MinimapPanel.Graphic->Frames)[x+(TheUI.MinimapPosX-TheUI.MinimapPanelX)
+ (y+TheUI.MinimapPosY-TheUI.MinimapPanelY) *
TheUI.MinimapPanel.Graphic->Width];
+ }
+ }
+ if (!TheUI.MinimapTransparent) {
+ // make only the inner part which is going to be used black
+ for (y = MinimapY; y < TheUI.MinimapH - MinimapY; ++y) {
+ for (x = MinimapX; x < TheUI.MinimapW - MinimapX; ++x) {
+ ((unsigned char*)MinimapGraphic->Frames)[x + y *
TheUI.MinimapW] =
+ ColorBlack;
+ }
+ }
+ }
UpdateMinimapTerrain();
}
@@ -246,7 +265,7 @@
global void UpdateMinimap(void)
{
static int red_phase;
- int new_phase;
+ int red_phase_changed;
int mx;
int my;
UnitType* type;
@@ -256,32 +275,28 @@
int h;
int h0;
- w = (FrameCounter / FRAMES_PER_SECOND) & 1;
- if ((new_phase = red_phase - w)) {
- red_phase = w;
+ red_phase_changed = red_phase != ((FrameCounter / FRAMES_PER_SECOND) & 1);
+ if (red_phase_changed) {
+ red_phase = !red_phase;
}
//
- // Set the pixels on the minimap background to transparent (0).
+ // Draw the terrain (or make it black again)
//
- // FIXME: make the image really use colorkey
- // FIXME: I think this is only necessary on each map size change?
- // Or maybe if you disable displaying terrain, too?
- memset(MinimapGraphic->Frames, 0, TheUI.MinimapW * TheUI.MinimapH);
-
- //
- // Draw the terrain
- //
- if (MinimapWithTerrain) {
- for (my = 0; my < TheUI.MinimapH; ++my) {
- for (mx = 0; mx < TheUI.MinimapW; ++mx) {
- if (IsMapFieldVisible(ThisPlayer, Minimap2MapX[mx],
Minimap2MapY[my] / TheMap.Width) ||
- (IsMapFieldExplored(ThisPlayer,Minimap2MapX[mx],
Minimap2MapY[my] / TheMap.Width) &&
- ((mx & 1) == (my & 1))) ||
- ReplayRevealMap) {
- ((unsigned char*)MinimapGraphic->Frames)[mx + my *
TheUI.MinimapW] =
- ((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my
* TheUI.MinimapW];
- }
+ for (my = 0; my < TheUI.MinimapH; ++my) {
+ for (mx = 0; mx < TheUI.MinimapW; ++mx) {
+ int visiontype; // 0 unexplored, 1 explored, >1 visible.
+ if (ReplayRevealMap) {
+ visiontype = 2;
+ } else {
+ visiontype = IsTileVisible(ThisPlayer, Minimap2MapX[mx],
Minimap2MapY[my] / TheMap.Width);
+ }
+ if (MinimapWithTerrain && (visiontype > 1 || (visiontype == 1 &&
((mx & 1) == (my & 1))))) {
+ ((unsigned char*)MinimapGraphic->Frames)[mx + my *
TheUI.MinimapW] =
+ ((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my *
TheUI.MinimapW];
+ } else if (visiontype > 0) {
+ ((unsigned char*)MinimapGraphic->Frames)[mx + my *
TheUI.MinimapW] =
+ ColorBlack;
}
}
}
@@ -365,6 +380,7 @@
if (type->ClicksToExplode) {
color = ColorNPC;
} else if (type->GivesResource == OilCost) {
+ // FIXME: move to ccl (OilCost)
color = ColorBlack;
} else {
color = ColorYellow;
@@ -372,10 +388,6 @@
} else if (unit->Player == ThisPlayer) {
if (unit->Attacked && red_phase) {
color = ColorRed;
- // better to clear to fast, than to clear never :?)
- if (new_phase) {
- unit->Attacked--;
- }
} else if (MinimapShowSelected && unit->Selected) {
color = ColorWhite;
} else {
@@ -402,6 +414,11 @@
mx + w + (my + h) * TheUI.MinimapW] = color;
}
}
+
+ // FIXME: bad place, but must be done for all units
+ if (red_phase_changed && unit->Attacked) {
+ unit->Attacked--;
+ }
}
}
@@ -414,10 +431,6 @@
global void DrawMinimap(int vx __attribute__((unused)),
int vy __attribute__((unused)))
{
- // draw background
- VideoDrawSubClip(TheUI.MinimapPanel.Graphic, 0, 0,
- TheUI.MinimapPanel.Graphic->Width, TheUI.MinimapPanel.Graphic->Height,
- TheUI.MinimapPanelX, TheUI.MinimapPanelY);
VideoDrawSubClip(MinimapGraphic, 0, 0,
MinimapGraphic->Width, MinimapGraphic->Height,
TheUI.MinimapPosX, TheUI.MinimapPosY);
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.130 stratagus/src/ui/ccl_ui.c:1.131
--- stratagus/src/ui/ccl_ui.c:1.130 Sat Oct 4 01:40:11 2003
+++ stratagus/src/ui/ccl_ui.c Mon Oct 6 16:54:15 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.130 2003/10/04 05:40:11 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.131 2003/10/06 20:54:15 martinxyz Exp $
//@{
@@ -1450,6 +1450,7 @@
ui->MinimapPanel.File = NULL;
ui->MinimapPanelX = -1;
ui->MinimapPanelY = -1;
+ ui->MinimapTransparent = 0;
ui->MinimapPosX = -1;
ui->MinimapPosY = -1;
@@ -1670,6 +1671,8 @@
sublist = gh_cdr(sublist);
ui->MinimapW = gh_scm2int(gh_car(value));
ui->MinimapH = gh_scm2int(gh_car(gh_cdr(value)));
+ } else if (gh_eq_p(value, gh_symbol2scm("transparent"))) {
+ ui->MinimapTransparent = 1;
} else {
errl("Unsupported tag", value);
}
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.75 stratagus/src/ui/ui.c:1.76
--- stratagus/src/ui/ui.c:1.75 Sat Oct 4 01:26:50 2003
+++ stratagus/src/ui/ui.c Mon Oct 6 16:54:15 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.75 2003/10/04 05:26:50 jsalmon3 Exp $
+// $Id: ui.c,v 1.76 2003/10/06 20:54:15 martinxyz Exp $
//@{
@@ -372,14 +372,16 @@
ui->MenuButtonGraphic.File, ui->MenuButtonGraphicX,
ui->MenuButtonGraphicY);
- CLprintf(file, " ; Minimap\n");
- CLprintf(file, " 'minimap-panel (list\n");
+ CLprintf(file, " 'minimap (list\n");
CLprintf(file, " 'file \"%s\"\n", ui->MinimapPanel.File);
- CLprintf(file, " 'panel-pos (%d %d)\n",
+ if (ui->MinimapTransparent) {
+ CLprintf(file, " 'transparent\n");
+ }
+ CLprintf(file, " 'panel-pos '(%d %d)\n",
ui->MinimapPanelX, ui->MinimapPanelY);
- CLprintf(file, " 'pos (%d %d)\n",
+ CLprintf(file, " 'pos '(%d %d)\n",
ui->MinimapPosX, ui->MinimapPosY);
- CLprintf(file, " 'size (%d %d))\n",
+ CLprintf(file, " 'size '(%d %d))\n",
ui->MinimapW, ui->MinimapH);
CLprintf(file, "\n 'status-line '(");
@@ -510,7 +512,7 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.75 2003/10/04 05:26:50
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.76 2003/10/06 20:54:15
martinxyz Exp $\n\n");
// Contrast, Brightness, Saturation
CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus doc/ChangeLog.html doc/ccl/ui.html sr...,
Martin Renold <=