JHGuitarFreak / UQM-MegaMod

A fork of The Ur-Quan Masters + HD-mod that remasters the HD graphics with a veritable smorgasbord of extra features, options, QoL improvements, and much more...
https://uqm-mods.sourceforge.net
GNU General Public License v2.0
80 stars 22 forks source link

List of small enhancements #64

Closed Kruzen closed 4 years ago

Kruzen commented 4 years ago

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 function ip_group_preprocess (): add next right after major condition if (task <= ON_STATION) (line 477-479):

else if (task >= REFORM_GROUP && optShipDirectionIP)
    {
        SIZE delta_x, delta_y;

        dest_pt.x = GroupPtr->loc.x << 1;
        dest_pt.y = GroupPtr->loc.y << 1;

        delta_x = dest_pt.x - GroupPtr->loc.x;
        delta_y = dest_pt.y - GroupPtr->loc.y;

        if (GroupPtr->race_id != SLYLANDRO_SHIP)
            EPtr->next.image.frame = SetAbsFrameIndex(EPtr->next.image.farray[0], 2 + NORMALIZE_FACING(ANGLE_TO_FACING(ARCTAN(delta_x, delta_y))));
        else
            EPtr->next.image.frame = IncFrameIndex(EPtr->next.image.frame);
    }

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):

if (GroupPtr->lastDirection < NORMALIZE_FACING(ANGLE_TO_FACING(ARCTAN(delta_x, delta_y)))
                        || GroupPtr->lastDirection == 15)

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. image 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 funstion LoadPlanet () right after StopMusic (); in line 269:

if (optIPScaler != OPT_3DO)
            SleepThread (1260);// 1.5 seconds

Make Water World sprite for HD "warmer"

image We can use Spathiwa itself for that: image

Make custom IP music play only if we discovered SOI

It is quite simple. Just change findRaceSOI () in grpinfo.c next condition (line 383) by adding known strength condition:

if ((encounter_radius = FleetPtr->actual_strength)
            && (i = EncounterPercent[Index]) && (FleetPtr->known_strength > 0))

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 of LoadIpData () in solarsys.c right before

if (!SysGenRNG)
    {
        SysGenRNG = RandomContext_New ();
    }

However 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.

Kruzen commented 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
    }
...
Kruzen commented 4 years ago

Implemented 3/4