Closed Kruzen closed 4 years ago
Better solution for ship facing. Edit: Fixed ships turning away from sis during red alert phase
1) We don't need BYTE lastDirection;
in IP_GROUP
struct in grpinfo.h. Change it too boolean: BOOLEAN canTurn;
2) Final code in ipdisp.c, function ip_group_preprocess (ELEMENT *ElementPtr)
...
if (task <= ON_STATION)
#endif /* NEVER */
{
BOOLEAN Transition, isOrbiting;
...
}
if (optShipDirectionIP)
{
if (GroupPtr->race_id != SLYLANDRO_SHIP)
{ //BW : make IP ships face the direction they're going into
if (GLOBAL (CurrentActivity) & START_ENCOUNTER)// sometimes they give up chase, don't turn them away from sis during red alert phase
suggestedFrame = SetAbsFrameIndex(EPtr->next.image.farray[0], GetFrameIndex(EPtr->current.image.frame));
else
suggestedFrame = SetAbsFrameIndex(EPtr->next.image.farray[0], 2 + NORMALIZE_FACING(ANGLE_TO_FACING(ARCTAN(delta_x, delta_y))));
// Set ship sprite when player entering the system (image index is always 1 by default)
if (GetFrameIndex(EPtr->current.image.frame) == 1)
EPtr->next.image.frame = suggestedFrame;
// Prevent ships from jittering while orbiting planet (not chasing a player)
if (isOrbiting)
{
if (GroupPtr->canTurn)
{
EPtr->next.image.frame = suggestedFrame;
GroupPtr->canTurn = FALSE;// cannot turn until destination is reached
}
}
else
EPtr->next.image.frame = suggestedFrame;
}
else
EPtr->next.image.frame = IncFrameIndex(EPtr->next.image.frame);
// If destination reached - ship can turn (or ship leaves/enters inner system, but not reached destination yet)
if ((dest_pt.x == GroupPtr->loc.x && dest_pt.y == GroupPtr->loc.y) || Transition)
GroupPtr->canTurn = TRUE;
}
}
else if (task >= REFORM_GROUP && optShipDirectionIP)// To face sis while reforming
{
if (GroupPtr->race_id != SLYLANDRO_SHIP)
{
if (GetFrameIndex(EPtr->current.image.frame) == 1)// Define direction only once and not follow player while reforming
{
SIZE delta_x, delta_y;
POINT sis_pt;
sis_pt = displayToLocation (GLOBAL (ShipStamp.origin), radius);
// Destination point is sis location
delta_x = sis_pt.x - GroupPtr->loc.x;
delta_y = sis_pt.y - GroupPtr->loc.y;
EPtr->next.image.frame = SetAbsFrameIndex(EPtr->next.image.farray[0], 2 + NORMALIZE_FACING (ANGLE_TO_FACING (ARCTAN (delta_x, delta_y))));
GroupPtr->canTurn = TRUE; // Allow ship to turn after reforming is complete and if no more chasing player
}
}
else
EPtr->next.image.frame = IncFrameIndex(EPtr->next.image.frame);// Probe will wobble while reforming
}
...
Implemented 3/4
Right sprites for reforming groups in original graphics
This is not 100% solution, sometimes they start facing 1 or 2 directions of, but it is more consistent in case of sprites.
ipdisp.c
functionip_group_preprocess ()
: add next right after major conditionif (task <= ON_STATION)
(line 477-479):If facing inconsistency is not tolerable, we can make them always face up with non-default sprite by changing line for defining next image frame for non-slylandro group and removing delta definitions and dest_pt calculation:
EPtr->next.image.frame = SetAbsFrameIndex(EPtr->next.image.farray[0], 2);
Also change
== 15
to== 0
in condition (line 466-467):It is more correct (fixes facing when entering system, and group direction is 0).
Make a small pause when entering orbit with stepped transitions
Entering planetary orbit passes too fast with stepped transitions. It ruins immersion or at least doesn't feel right. There was a pause in PC-DOS (although it could be loading issue of some sort) and in smooth it's on screen until planet sphere is comletely zoomed in. So I suggest to add a tiny pause (1.5 seconds or close to that but not less than 1 second).
planets.c
funstionLoadPlanet ()
right afterStopMusic ();
in line 269:Make Water World sprite for HD "warmer"
We can use Spathiwa itself for that:
Make custom IP music play only if we discovered SOI
It is quite simple. Just change
findRaceSOI ()
ingrpinfo.c
next condition (line 383) by adding known strength condition:Now, here comes BUTs 1) If we discover race via their homeworld, music won't change from what has been picked during system entering. It also can be fixed by adding
SpaceMusic = 0;
in the end ofLoadIpData ()
insolarsys.c
right beforeHowever there was resource leak fix and I'm not sure how safe is to change anything here. So far it's working well on my end. 2) It is important to know Volasaurus' opinion on that change, since he is the author of tracks.