LTCHIPS / rottexpr

A Rise Of The Triad Source Port with additional gameplay options and more...
GNU General Public License v2.0
98 stars 26 forks source link

Unable to build with ammo pickup option code in rt_playr.c on Mac #36

Closed bernarddavis closed 3 years ago

bernarddavis commented 4 years ago

I am only able to run make on macOS with the following code removed from rt_playr.c on Mac

if (enableAmmoPickups && DetermineAmmoPickup(pstate, check))
    {
        wasAmmoPickup = true;
        GivePlayerAmmo(ob, check, GetWeaponForItem(check->itemnumber));
        if ((ob==player) && SHOW_BOTTOM_STATUS_BAR() )
            DrawBarAmmo (false);
        SD_PlaySoundRTP(SD_GETWEAPONSND,ob->x, ob->y);
        return true;
    }

    else if ((GetWeaponForItem(check->itemnumber) == pstate->missileweapon) &&
            (pstate->ammo >= check->ammo) && enableAmmoPickups)
        return false;

The following error occurs when running make:

Undefined symbols for architecture x86_64:
  "_DetermineAmmoPickup", referenced from:
      _GivePlayerMissileWeapon in rt_playr.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rott] Error 1

With the above code commented out I can make and run the game no problem.

clobber commented 4 years ago

Removing code isn't the correct approach...

The problem is the definition of DetermineAmmoPickup() is incorrect and clang is catching that.

Instead of inline boolean DetermineAmmoPickup(playertype *pstate, statobj_t *check) it should be static inline boolean DetermineAmmoPickup(playertype *pstate, statobj_t *check)