Fixed bug #108, extending chmmravatar's patch. Also added comments, and did

some general cleanups.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1117 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2003-08-24 16:33:33 +00:00
parent 7ebc57770c
commit 15cd9cff30
2 changed files with 40 additions and 19 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3: Changes towards version 0.3:
- Fixed bug with entering closing portals (bug #108) - SvdB+chmmravatar
- Mouse cursor is now hidden in fullscreen mode (bug #173) -Mika - Mouse cursor is now hidden in fullscreen mode (bug #173) -Mika
- Version checks inside the input code to flag incompatible changes --Michael - Version checks inside the input code to flag incompatible changes --Michael
- Install location for content on unix systems is now ${prefix}/share/uqm - Install location for content on unix systems is now ${prefix}/share/uqm
+39 -19
View File
@@ -452,7 +452,7 @@ unhyper_transition (PELEMENT ElementPtr)
break; break;
case INTERPLANETARY_TRANSITION: case INTERPLANETARY_TRANSITION:
SET_GAME_STATE (USED_BROADCASTER, 0); SET_GAME_STATE (USED_BROADCASTER, 0);
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) == 0) if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{ {
GLOBAL (CurrentActivity) |= START_INTERPLANETARY; GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
SET_GAME_STATE (ESCAPE_COUNTER, 0); SET_GAME_STATE (ESCAPE_COUNTER, 0);
@@ -505,32 +505,41 @@ unhyper_transition (PELEMENT ElementPtr)
} }
break; break;
case ARILOU_SPACE_TRANSITION: case ARILOU_SPACE_TRANSITION:
/* Enter QuasiSpace from HyperSpace by any portal,
* or HyperSpace from QuasiSpace through the periodically
* opening portal.
*/
SET_GAME_STATE (USED_BROADCASTER, 0); SET_GAME_STATE (USED_BROADCASTER, 0);
GLOBAL (autopilot.x) = GLOBAL (autopilot.x) =
GLOBAL (autopilot.y) = ~0; GLOBAL (autopilot.y) = ~0;
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) == 0) if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{ {
// From HyperSpace to QuasiSpace.
GLOBAL_SIS (log_x) = GLOBAL_SIS (log_x) =
UNIVERSE_TO_LOGX (QUASI_SPACE_X); UNIVERSE_TO_LOGX (QUASI_SPACE_X);
GLOBAL_SIS (log_y) = GLOBAL_SIS (log_y) =
UNIVERSE_TO_LOGY (QUASI_SPACE_Y); UNIVERSE_TO_LOGY (QUASI_SPACE_Y);
if (GET_GAME_STATE (PORTAL_COUNTER) == 0) if (GET_GAME_STATE (PORTAL_COUNTER) == 0)
{ {
SET_GAME_STATE (ARILOU_SPACE_SIDE, 2); // Periodically appearing portal.
SET_GAME_STATE (ARILOU_SPACE_SIDE, 3);
} }
else else
{ {
// Player-induced portal.
SET_GAME_STATE (PORTAL_COUNTER, 0); SET_GAME_STATE (PORTAL_COUNTER, 0);
SET_GAME_STATE (ARILOU_SPACE_SIDE, 3); SET_GAME_STATE (ARILOU_SPACE_SIDE, 3);
} }
} }
else else
{ {
// From QuasiSpace to HyperSpace through the
// periodically appearing portal.
GLOBAL_SIS (log_x) = GLOBAL_SIS (log_x) =
UNIVERSE_TO_LOGX (ARILOU_SPACE_X); UNIVERSE_TO_LOGX (ARILOU_SPACE_X);
GLOBAL_SIS (log_y) = GLOBAL_SIS (log_y) =
UNIVERSE_TO_LOGY (ARILOU_SPACE_Y); UNIVERSE_TO_LOGY (ARILOU_SPACE_Y);
SET_GAME_STATE (ARILOU_SPACE_SIDE, 1); SET_GAME_STATE (ARILOU_SPACE_SIDE, 0);
} }
break; break;
} }
@@ -1311,7 +1320,8 @@ void
SeedUniverse (void) SeedUniverse (void)
{ {
COORD ox, oy; COORD ox, oy;
COORD ux, uy, sx, sy, ex, ey; COORD sx, sy, ex, ey;
SWORD portalCounter, arilouSpaceCounter, arilouSpaceSide;
POINT universe; POINT universe;
FRAME blip_frame; FRAME blip_frame;
STAMP s; STAMP s;
@@ -1344,8 +1354,8 @@ SeedUniverse (void)
* RADAR_HEIGHT / RADAR_SCAN_HEIGHT) * RADAR_HEIGHT / RADAR_SCAN_HEIGHT)
- (RADAR_HEIGHT >> 1); - (RADAR_HEIGHT >> 1);
ux = GET_GAME_STATE (ARILOU_SPACE_COUNTER); arilouSpaceCounter = GET_GAME_STATE (ARILOU_SPACE_COUNTER);
uy = GET_GAME_STATE (ARILOU_SPACE_SIDE); arilouSpaceSide = GET_GAME_STATE (ARILOU_SPACE_SIDE);
// if (ox != ex || oy != ey) // if (ox != ex || oy != ey)
{ {
@@ -1360,7 +1370,8 @@ SeedUniverse (void)
ex = SDPtr->star_pt.x; ex = SDPtr->star_pt.x;
ey = SDPtr->star_pt.y; ey = SDPtr->star_pt.y;
star_type = STAR_TYPE (SDPtr->Type); star_type = STAR_TYPE (SDPtr->Type);
if (uy >= 2 && ex == ARILOU_HOME_X && ey == ARILOU_HOME_Y) if (arilouSpaceSide >= 2 &&
ex == ARILOU_HOME_X && ey == ARILOU_HOME_Y)
star_type = SUPER_GIANT_STAR; star_type = SUPER_GIANT_STAR;
s.origin.x = (COORD)((long)ex * RADAR_WIDTH s.origin.x = (COORD)((long)ex * RADAR_WIDTH
@@ -1374,45 +1385,54 @@ SeedUniverse (void)
} }
} }
if ((ex = GET_GAME_STATE (PORTAL_COUNTER)) || ux) portalCounter = GET_GAME_STATE (PORTAL_COUNTER);
if (portalCounter || arilouSpaceCounter)
{ {
COUNT i; COUNT i;
STAR_DESC SD[2]; STAR_DESC SD[2];
// This array is filled with the STAR_DESC's of
// QuasiSpace portals that need to be taken into account.
// i is set the the number of active portals (max 2).
i = 0; i = 0;
if (ex) if (portalCounter)
{ {
// A player-created QuasiSpace portal is opening.
static POINT portal_pt; static POINT portal_pt;
SD[i].Index = ((ex - 1) >> 1) + 18; SD[i].Index = ((portalCounter - 1) >> 1) + 18;
if (ex == 1) if (portalCounter == 1)
portal_pt = universe; portal_pt = universe;
SD[i].star_pt = portal_pt; SD[i].star_pt = portal_pt;
++i; ++i;
if (++ex == (10 + 1)) if (++portalCounter == (10 + 1))
ex = (9 + 1); portalCounter = (9 + 1);
SET_GAME_STATE (PORTAL_COUNTER, ex); SET_GAME_STATE (PORTAL_COUNTER, portalCounter);
} }
if (ux) if (arilouSpaceCounter)
{ {
SD[i].Index = ux >> 1; // The periodically appearing QuasiSpace portal is open.
if (uy <= 1) SD[i].Index = arilouSpaceCounter >> 1;
if (arilouSpaceSide <= 1)
{ {
// The player is in HyperSpace
SD[i].Index += 18; SD[i].Index += 18;
SD[i].star_pt.x = ARILOU_SPACE_X; SD[i].star_pt.x = ARILOU_SPACE_X;
SD[i].star_pt.y = ARILOU_SPACE_Y; SD[i].star_pt.y = ARILOU_SPACE_Y;
} }
else else
{ {
// The player is in QuasiSpace
SD[i].star_pt.x = QUASI_SPACE_X; SD[i].star_pt.x = QUASI_SPACE_X;
SD[i].star_pt.y = QUASI_SPACE_Y; SD[i].star_pt.y = QUASI_SPACE_Y;
} }
++i; ++i;
} }
// Process the i portals from SD.
do do
{ {
--i; --i;
@@ -1451,7 +1471,7 @@ SeedUniverse (void)
SetUpElement (HyperSpaceElementPtr); SetUpElement (HyperSpaceElementPtr);
if (uy == 1 || uy == 2) if (arilouSpaceSide == 1 || arilouSpaceSide == 2)
HyperSpaceElementPtr->death_func = arilou_space_death; HyperSpaceElementPtr->death_func = arilou_space_death;
else else
{ {