arx-insanity / ArxLibertatis

Cross-platform port of Arx Fatalis, a first-person role-playing game
https://arx-libertatis.org/
GNU General Public License v3.0
3 stars 0 forks source link

Improve character creation by adding 6 new face options #41

Closed meszaros-lajos-gyorgy closed 1 year ago

meszaros-lajos-gyorgy commented 1 year ago

npc_human_base_hero_head, npc_human_base_hero2_head, ..., npc_human_base_hero10_head

meszaros-lajos-gyorgy commented 1 year ago

My notes based on my research:

npc_human_base_hero

src/game/Player.cpp
    ARX_PLAYER_Restore_Skin()
        **player.skin** controls which skin to load
        0..3 = 4 basic player skins
        4 = max cheat player skin
        5 = additional player skin which can only be attained with the updown*3 spell
        6 = some sort of backup for skin #5, maybe for when any of the player.skin calculation goes above 5

----------------

player.skin

src/game/Player.cpp
    ARX_PLAYER_MakeFreshHero()
        sets player.skin to 0
    ARX_PLAYER_MakeSpHero()
        sets player.skin to 4
    ARX_PLAYER_QuickGeneration()
        saves player.skin to a temporary variable then restores it later
    ARX_PLAYER_LoadHeroAnimsAndMesh()
        sets player skin to 0
    ARX_PLAYER_Restore_Skin()
        see previous block regarding "npc_human_base_hero"

src/game/spell/Cheat.cpp
    ApplySPMax()
        sets player skin to 4
    handleCheatRuneDetection()
        CheatRune_ChangeSkin increases player skin by 1 and there's a 90% chance that it skips
        skin 4 and jumps directly to skin 5
        above 5 it jumps back to 0

src/gui/CharacterCreation.cpp
    CharacterCreation::render()
        // Button QUICK GENERATION
        saves player.skin, generates a new hero then restores it
        // Button SKIN
        increases player.skin by 1 and if it's more than 3 then loops back to 0
        // Button DONE
        if the player generation cheat is activated then sets player.skin to 4

src/gui/Menu.cpp
    ARX_MENU_Clicked_NEWQUEST()
        sets player.skin to 0

src/gui/book/Book.cpp
    StatsPage::RenderBookPlayerCharacter()
        if ARXmenu.mode() == Mode_CharacterCreation then based on the value of player.skin
        the game sets a rotation to the player model

src/scene/ChangeLevel.cpp
    ARX_CHANGELEVEL_Push_Player()
        backs up player.skin to asp->skin
    ARX_CHANGELEVEL_Pop_Player()
        restores player.skin from asp->skin

    asp->skin is not used anywhere else and it never gets modified so I think it's safe to ignore this
    ARX_CHANGELEVEL_PLAYER * asp; (?)
meszaros-lajos-gyorgy commented 1 year ago

Here's a fallback mechanism for cases when a player texture didn't load: https://github.com/arx-insanity/ArxLibertatis/blob/master/src/game/Player.cpp#L1069