Jump to content

need suggest: Change Force Power Icon by player class. (Single Player game)


Go to solution Solved by Raz0r,

Recommended Posts

Hello, i need a little suggest about that.

I was wondering, if there is some way, working on void CG_init on cg_main.cpp , for changing force power icon by CLASS of Npc that using force power and is the playermodel.

for example.

in case the player use a model and enable it loading with playermodel command.

it load a NPC file and set the player model with npc attributes.

so, if i put in consolle "playermodel kyle" i get kyle katarn model with kyle katarn NPC settings for player force powers.

What i am asking if is possible to work on this code:

 

 

void CG_Init( int serverCommandSequence )
{
    // New Adding
    gentity_t    *player = &g_entities[0];
    //
    cgs.serverCommandSequence = serverCommandSequence;

    cgi_Cvar_Set( "cg_drawHUD", "1" );

    // fonts...
    //
    cgs.media.charsetShader = cgi_R_RegisterShaderNoMip("gfx/2d/charsgrid_med");

    cgs.media.qhFontSmall = cgi_R_RegisterFont("ocr_a");
    cgs.media.qhFontMedium= cgi_R_RegisterFont("ergoec");

    cgs.media.whiteShader   = cgi_R_RegisterShader( "white" );
    cgs.media.loadTick        = cgi_R_RegisterShaderNoMip( "gfx/hud/load_tick" );
    cgs.media.loadTickCap    = cgi_R_RegisterShaderNoMip( "gfx/hud/load_tick_cap" );

    const char    *force_icon_files[NUM_FORCE_POWERS] =
    {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_lt_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_stoneglyph",        //FP_STONEGLYPH
        "gfx/mp/f_icon_soundglyph",        //FP_SOUNDGLYPH
        "gfx/mp/f_icon_waterglyph",    //FP_WATERGLYPH
        "gfx/mp/f_icon_fireglyph",    //FP_FIREGLYPH
        "gfx/mp/f_icon_sunglyph",            //FP_SUNGLYPH
        "gfx/mp/f_icon_windglyph",            //FP_WINDGLYPH
        "gfx/mp/f_icon_holyglyph",            //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",            //FP_DARKGLYPH
        "gfx/mp/f_icon_necroglyph",            //FP_NECROGLYPH*/
    };
    
    // Precache inventory icons
    for ( int i=0;i<NUM_FORCE_POWERS;i++)
    {
        if (force_icon_files[i])
        {
            force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files[i] );
        }
    }

    CG_LoadHudMenu();      // load new hud stuff

    cgi_UI_Menu_OpenByName("loadscreen");

    //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
    memset( cg_entities, 0, sizeof(cg_entities) );

    CG_TransitionPermanent();

    cg.loadLCARSStage        = 0;

    CG_GameStateReceived();

    CG_InitConsoleCommands();

    //
    // the game server will interpret these commands, which will be automatically
    // forwarded to the server after they are not recognized locally
    //
    cgi_AddCommand ("kill");
    cgi_AddCommand ("give");
    cgi_AddCommand ("god");
    cgi_AddCommand ("notarget");
    cgi_AddCommand ("noclip");
    cgi_AddCommand ("undying");
    cgi_AddCommand ("setviewpos");
    cgi_AddCommand ("setobjective");
    cgi_AddCommand ("viewobjective");


//ConsoleCommand in g_svcmds.cpp
    cgi_AddCommand ("entitylist");
    cgi_AddCommand ("nav");
    cgi_AddCommand ("npc");

    cgi_AddCommand ("saberColor");
    cgi_AddCommand ("saber");
    cgi_AddCommand ("saberblade");
    cgi_AddCommand ("setForceAll");

    cgi_AddCommand ("runscript");

    cgi_AddCommand ("playerteam");
    cgi_AddCommand ("playermodel");

    cgi_AddCommand ("saberAttackCycle");

    cgi_AddCommand ("use_electrobinoculars");
    cgi_AddCommand ("use_bacta");
    cgi_AddCommand ("use_seeker");
    cgi_AddCommand ("use_lightamp_goggles");
    cgi_AddCommand ("use_sentry");

    cgi_AddCommand ("force_throw");
    cgi_AddCommand ("force_pull");
    cgi_AddCommand ("force_speed");
    cgi_AddCommand ("force_heal");
    cgi_AddCommand ("force_grip");
    cgi_AddCommand ("force_distract");
    cgi_AddCommand ("force_rage");
    cgi_AddCommand ("force_protect");
    cgi_AddCommand ("force_absorb");
    cgi_AddCommand ("force_sight");
    cgi_AddCommand ("force_stun");
    cgi_AddCommand ("force_hate");
    cgi_AddCommand ("force_controlmind");
    cgi_AddCommand ("force_freeze");
    cgi_AddCommand ("force_fear");
    cgi_AddCommand ("force_wrack");
    cgi_AddCommand ("force_repel");
    cgi_AddCommand ("force_glyph");
    cgi_AddCommand ("stone_glyph");
    cgi_AddCommand ("sound_glyph");
    cgi_AddCommand ("water_glyph");
    cgi_AddCommand ("fire_glyph");
    cgi_AddCommand ("sun_glyph");

    cgi_AddCommand ("taunt");
    cgi_AddCommand ("bow");
    cgi_AddCommand ("meditate");
    cgi_AddCommand ("flourish");
    cgi_AddCommand ("gloat");

    cg.weaponPickupTextTime = 0;

    cg.missionInfoFlashTime = 0;
    cg.missionStatusShow = qfalse;

    cg.missionFailedScreen = qfalse;    // Screen hasn't been opened.
    cgi_UI_MenuCloseAll();    /*for (int i = 0; i < WP_NUM_WEAPONS; i++ ) CG_RegisterWeapon(i); }// So the loadscreen menu will turn off just after the opening snapshot
    cgi_UI_MenuCloseAll();    // So the loadscreen menu will turn off just after the opening snapshot*/
}

 

for making something like that, that can work in game:

 

 

if ( self->client->NPC_class == CLASS_LUKE )
{
const char    *force_icon_files[NUM_FORCE_POWERS] =
    {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_lt_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_stoneglyph",        //FP_STONEGLYPH
        "gfx/mp/f_icon_soundglyph",        //FP_SOUNDGLYPH
        "gfx/mp/f_icon_waterglyph",    //FP_WATERGLYPH
        "gfx/mp/f_icon_fireglyph",    //FP_FIREGLYPH
        "gfx/mp/f_icon_sunglyph",            //FP_SUNGLYPH
        "gfx/mp/f_icon_windglyph",            //FP_WINDGLYPH
        "gfx/mp/f_icon_holyglyph",            //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",            //FP_DARKGLYPH
        "gfx/mp/f_icon_necroglyph",            //FP_NECROGLYPH*/
    };
 };
else if ( self->client->NPC_class == CLASS_KYLE )
{
const char    *force_icon_files[NUM_FORCE_POWERS] =
    {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_dk_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_dk_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain2",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_timeglyph",        //FP_STONEGLYPH
        "gfx/mp/f_icon_spaceglyph",        //FP_SOUNDGLYPH
        "gfx/mp/f_icon_statesglyph",    //FP_WATERGLYPH
        "gfx/mp/f_icon_conflictglyph",    //FP_FIREGLYPH
        "gfx/mp/f_icon_energyglyph",            //FP_SUNGLYPH
        "gfx/mp/f_icon_mindglyph",            //FP_WINDGLYPH
        "gfx/mp/f_icon_balanceglyph",            //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",            //FP_DARKGLYPH
        "gfx/mp/f_icon_deathglyph",            //FP_NECROGLYPH*/
    };
 };
else if ... etc

 

yes, i added some new force power.

obvious, in this case not works. because self is not defined in cg_init.

I hope someone can give me some suggest about that.

thanks for any answer :)

 

 

 

 

Link to comment

You will want to register several icons (as shaders) in CG_Init, and choose which shader handle to draw each frame based on player class.

 

so i add at the start of cg_init

gentity_t    *self   (like at the start of some force powers like forcetelepathy) , so is included and defined, and i register the new shader pictures  before i call it with the else if arrays. thanks :)

Link to comment

No. The player model (and/or NPC data) can change after initialisation.

In CG_Init, register all of the potentially used icons and save them into different handles.

 

Then, on each frame (when rendering the force selection stuff) you tell it to use different icons based on the NPC data.

eezstreet and Asgarath83 like this
Link to comment

Uff, bad work >.<

On cg_media.h

 

    // ALL FORCE ICON POWERS SHADERS
    // Heals
    qhandle_t    heal_icon;
    qhandle_t    heal_v_icon;
    qhandle_t    heal_d_icon;
    qhandle_t    heal_h_icon;
    qhandle_t    heal_s_icon;
    // Jump
    qhandle_t    jump_icon;
    // Speed
    qhandle_t    speed_icon;
    // Telekinesis
    qhandle_t    push_icon;
    qhandle_t    pull_icon;
    qhandle_t    grip_icon;
    // Sword skills
    qhandle_t    saber_attack;
    qhandle_t    saber_throw;
    qhandle_t    saber_defend;
    // Rage
    qhandle_t    icon_rage;
    qhandle_t    icon_berserk;
    qhandle_t    icon_trance;
    qhandle_t    icon_fear;
    qhandle_t    icon_runeshield;
    qhandle_t    icon_tkshield;
    qhandle_t    icon_eldershield;
    qhandle_t    icon_poisonshield;
    // REPELS
    qhandle_t    icon_protect;
    qhandle_t    icon_absorb;
    // DRAINS
    qhandle_t    icon_bloodgout;
    qhandle_t    icon_bloodshower;
    qhandle_t    icon_souldrain;
    qhandle_t    icon_necrodrain;
    qhandle_t    icon_hyldendrain;
    qhandle_t    icon_demondrain;
    // VAMPIRES DARK POWERS
    qhandle_t    icon_light;
    qhandle_t    icon_revelation;
    qhandle_t    icon_stun;
    qhandle_t    icon_hate;
    qhandle_t    icon_controlmind;
    qhandle_t    icon_incapacitate;
    qhandle_t    icon_fear2;
    qhandle_t    icon_wrack;
    // GLYPH POWERS
    qhandle_t    icon_forceglyph;
    qhandle_t    icon_stoneglyph;
    qhandle_t    icon_soundglyph;
    qhandle_t    icon_waterglyph;
    qhandle_t    icon_fireglyph;
    qhandle_t    icon_sunglyph;
    // THE REAVERS
    qhandle_t    icon_darkreaver;
    qhandle_t    icon_smogreaver;
    qhandle_t    icon_voidreaver;
    qhandle_t    icon_lightreaver;
    qhandle_t    icon_lightningreaver;
    qhandle_t    icon_sunreaver;
    qhandle_t    icon_firereaver;
    qhandle_t    icon_warmreaver;
    qhandle_t    icon_magmareaver;
    qhandle_t    icon_airreaver;
    qhandle_t    icon_fogreaver;
    qhandle_t    icon_stormreaver;
    qhandle_t    icon_waterreaver;
    qhandle_t    icon_icereaver;
    qhandle_t    icon_crystalreaver;
    qhandle_t    icon_earthreaver;
    qhandle_t    icon_mudreaver;
    qhandle_t    icon_stonereaver;
    qhandle_t    icon_dustreaver;
    qhandle_t    icon_poisonreaver;
    qhandle_t    icon_deathreaver;
    qhandle_t    icon_spectralreaver;
    qhandle_t    icon_spiritreaver;
    qhandle_t    icon_holyreaver;
    qhandle_t    icon_lifereaver;
    qhandle_t    icon_soundreaver;
    qhandle_t    icon_astralreaver;
    // THE PILLARS
    qhandle_t    icon_mindreaver;
    qhandle_t    icon_dimensionreaver;
    qhandle_t    icon_conflictreaver;
    qhandle_t    icon_naturereaver;
    qhandle_t    icon_energyreaver;
    qhandle_t    icon_timereaver;
    qhandle_t    icon_statesreaver;
    qhandle_t    icon_deathreaver2;
    qhandle_t    icon_soulreaver;
    qhandle_t    icon_bloodreaver;
    qhandle_t    icon_balancereaver;
    // ARCANE ATTACKS
    qhandle_t    icon_energybolt;
    qhandle_t    icon_lightning;
    qhandle_t    icon_web;
    qhandle_t    icon_ghost;     
    qhandle_t    icon_life;
    qhandle_t    icon_hollyfire;
    qhandle_t    icon_necro;
    qhandle_t    icon_psychic;
    qhandle_t    icon_crystal;
    qhandle_t    icon_stone;
    qhandle_t    icon_water;
    qhandle_t    icon_fire;
    qhandle_t    icon_skull;
    qhandle_t    icon_lava;
    qhandle_t    icon_poison;
    qhandle_t    icon_hell;
    qhandle_t    icon_hylden;
    qhandle_t    icon_greenlightning;
    qhandle_t    icon_yellowlightning;
    qhandle_t    icon_wind;
    qhandle_t    icon_burst;
    qhandle_t    icon_ice;
    qhandle_t    icon_dark;
    qhandle_t    icon_void;
    qhandle_t    icon_smog;
    qhandle_t    icon_sonic;
    qhandle_t    icon_acid;
    qhandle_t    icon_astral;
    qhandle_t    icon_fireball;
    qhandle_t    icon_holly;
  
[

On cg_main.cpp

 

void CG_Init( int serverCommandSequence )
{
    // New Adding
    gentity_t    *player = &g_entities[0];
    //
    cgs.serverCommandSequence = serverCommandSequence;

    cgi_Cvar_Set( "cg_drawHUD", "1" );

    // fonts...
    //
    cgs.media.charsetShader = cgi_R_RegisterShaderNoMip("gfx/2d/charsgrid_med");

    cgs.media.qhFontSmall = cgi_R_RegisterFont("ocr_a");
    cgs.media.qhFontMedium = cgi_R_RegisterFont("ergoec");

    cgs.media.whiteShader   = cgi_R_RegisterShader( "white" );
    cgs.media.loadTick        = cgi_R_RegisterShaderNoMip( "gfx/hud/load_tick" );
    cgs.media.loadTickCap    = cgi_R_RegisterShaderNoMip( "gfx/hud/load_tick_cap" );
    // ALL ICON REGISTERED!
    cgs.media.heal_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_lt_heal" );
    cgs.media.heal_v_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_v_heal" );
    cgs.media.heal_d_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_d_heal" );
    cgs.media.heal_h_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_h_heal" );
    cgs.media.heal_s_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_s_heal" );
    cgs.media.jump_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_levitation" );
    cgs.media.pull_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_pull" );
    cgs.media.push_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_push" );
    cgs.media.speed_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_speed" );
    cgs.media.grip_icon =  cgi_R_RegisterShader( "gfx/hud/f_icon_dk_grip" );
    cgs.media.saber_attack =  cgi_R_RegisterShader( "gfx/hud/f_icon_saber_attack" );
    cgs.media.saber_throw =  cgi_R_RegisterShader( "gfx/hud/f_icon_saber_throw" );
    cgs.media.saber_defend = cgi_R_RegisterShader( "gfx/hud/f_icon_saber_defend" );
    cgs.media.icon_rage =  cgi_R_RegisterShader( "gfx/hud/f_icon_dk_rage" );
    cgs.media.icon_berserk = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_berserk" );
    cgs.media.icon_trance = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_trance" );
    cgs.media.icon_fear =  cgi_R_RegisterShader( "gfx/hud/f_icon_dk_fear" );
    cgs.media.icon_runeshield = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_runeshield" );
    cgs.media.icon_tkshield = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_tkshield" );
    cgs.media.icon_eldershield = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_eldershield" );
    cgs.media.icon_poisonshield = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_poisonshield" );
    // REPELS
    cgs.media.icon_protect = cgi_R_RegisterShader( "gfx/hud/f_icon_lt_protect" );
    cgs.media.icon_absorb = cgi_R_RegisterShader( "gfx/hud/f_icon_lt_absorb" );
    // DRAINS
    cgs.media.icon_bloodgout = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_drain" );
    cgs.media.icon_bloodshower = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_drain2" );
    cgs.media.icon_souldrain = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_souldrain" );
    cgs.media.icon_necrodrain = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_necrodrain" );
    cgs.media.icon_hyldendrain = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_hyldendrain" );
    cgs.media.icon_demondrain = cgi_R_RegisterShader( "gfx/hud/f_icon_dk_demondrain" );
    // VAMPIRES DARK POWERS
        cgs.media.icon_light = cgi_R_RegisterShader( "gfx/hud/f_icon_sight" );
        cgs.media.icon_revelation = cgi_R_RegisterShader( "gfx/hud/f_icon_sight2" );
    cgs.media.icon_stun = cgi_R_RegisterShader( "gfx/hud/f_icon_stun" );
    cgs.media.icon_hate = cgi_R_RegisterShader( "gfx/hud/f_icon_hate" );
    cgs.media.icon_controlmind = cgi_R_RegisterShader( "gfx/hud/f_icon_controlmind" );
    cgs.media.icon_incapacitate = cgi_R_RegisterShader( "gfx/hud/f_icon_incapacitate" );
    cgs.media.icon_fear2 = cgi_R_RegisterShader( "gfx/hud/f_icon_fear" );
    cgs.media.icon_wrack = cgi_R_RegisterShader( "gfx/hud/f_icon_wrack" );
    // GLYPH POWERS
    cgs.media.icon_forceglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_forceglyph" );
    cgs.media.icon_stoneglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_stoneglyph" );
    cgs.media.icon_soundglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_soundglyph" );
    cgs.media.icon_waterglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_waterglyph" );
    cgs.media.icon_fireglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_fireglyph" );
    cgs.media.icon_sunglyph = cgi_R_RegisterShader( "gfx/hud/f_icon_sunglyph" );
    // THE REAVERS
    cgs.media.icon_darkreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_darkreaver" );
    cgs.media.icon_smogreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_smogreaver" );
    cgs.media.icon_voidreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_voidreaver" );
    cgs.media.icon_lightreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_lightreaver" );
    cgs.media.icon_lightningreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_lighningreaver" );
    cgs.media.icon_sunreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_sunreaver" );
    cgs.media.icon_firereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_firereaver" );
    cgs.media.icon_warmreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_warmreaver" );
    cgs.media.icon_magmareaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_magmareaver" );
    cgs.media.icon_airreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_airreaver" );
    cgs.media.icon_fogreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_fogreaver" );
    cgs.media.icon_stormreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_stormreaver" );
    cgs.media.icon_waterreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_waterreaver" );
    cgs.media.icon_icereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_icereaver" );
    cgs.media.icon_crystalreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_crystalreaver" );
    cgs.media.icon_earthreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_earthreaver" );
    cgs.media.icon_mudreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_mudreaver" );
    cgs.media.icon_stonereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_stonereaver" );
    cgs.media.icon_dustreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_dustreaver" );
    cgs.media.icon_poisonreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_poisonreaver" );
    cgs.media.icon_deathreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_deathreaver" );
    cgs.media.icon_spectralreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_spectralreaver" );
    cgs.media.icon_spiritreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_spiritreaver" );
    cgs.media.icon_holyreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_holyreaver" );
    cgs.media.icon_lifereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_lifereaver" );
    cgs.media.icon_soundreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_soundreaver" );
    cgs.media.icon_astralreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_astralreaver" );
    // THE PILLARS
    cgs.media.icon_mindreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_mindreaver" );
    cgs.media.icon_dimensionreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_dimensionreaver" );
    cgs.media.icon_conflictreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_conflictreaver" );
    cgs.media.icon_naturereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_naturereaver" );
    cgs.media.icon_energyreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_energyreaver" );
    cgs.media.icon_timereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_timereaver" );
    cgs.media.icon_statesreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_statesreaver" );
    cgs.media.icon_deathreaver2 =  cgi_R_RegisterShader( "gfx/hud/f_icon_deathreaver2" );
    cgs.media.icon_soulreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_soulreaver" );
    cgs.media.icon_bloodreaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_bloodreaver" );
    cgs.media.icon_balancereaver =  cgi_R_RegisterShader( "gfx/hud/f_icon_balancereaver" );
    // ARCANE ATTACKS
    cgs.media.icon_energybolt =  cgi_R_RegisterShader( "gfx/hud/f_icon_dk_l1" );
    cgs.media.icon_lightning =  cgi_R_RegisterShader( "gfx/hud/f_icon_dk_l2" );
    cgs.media.icon_web =  cgi_R_RegisterShader( "gfx/hud/f_icon_web" );
    cgs.media.icon_ghost =  cgi_R_RegisterShader( "gfx/hud/f_icon_ghost" );
    cgs.media.icon_life =  cgi_R_RegisterShader( "gfx/hud/f_icon_life" );
    cgs.media.icon_hollyfire =  cgi_R_RegisterShader( "gfx/hud/f_icon_hollyfire" );
    cgs.media.icon_necro =  cgi_R_RegisterShader( "gfx/hud/f_icon_necro" );
    cgs.media.icon_psychic =  cgi_R_RegisterShader( "gfx/hud/f_icon_psychic" );
    cgs.media.icon_crystal =  cgi_R_RegisterShader( "gfx/hud/f_icon_crystal" );
    cgs.media.icon_stone =  cgi_R_RegisterShader( "gfx/hud/f_icon_stone" );
    cgs.media.icon_water =  cgi_R_RegisterShader( "gfx/hud/f_icon_water" );
    cgs.media.icon_fire =  cgi_R_RegisterShader( "gfx/hud/f_icon_fire" );
    cgs.media.icon_skull =  cgi_R_RegisterShader( "gfx/hud/f_icon_skull" );
    cgs.media.icon_lava =  cgi_R_RegisterShader( "gfx/hud/f_icon_lava" );
    cgs.media.icon_poison =  cgi_R_RegisterShader( "gfx/hud/f_icon_poison" );
    cgs.media.icon_hell =  cgi_R_RegisterShader( "gfx/hud/f_icon_hell" );
    cgs.media.icon_hylden =  cgi_R_RegisterShader( "gfx/hud/f_icon_hylden" );
    cgs.media.icon_greenlightning =  cgi_R_RegisterShader( "gfx/hud/f_icon_greenlightning" );
    cgs.media.icon_yellowlightning =  cgi_R_RegisterShader( "gfx/hud/f_icon_yellowlightning" );
    cgs.media.icon_wind =  cgi_R_RegisterShader( "gfx/hud/f_icon_wind" );
    cgs.media.icon_burst =  cgi_R_RegisterShader( "gfx/hud/f_icon_burst" );
    cgs.media.icon_ice =  cgi_R_RegisterShader( "gfx/hud/f_icon_ice" );
    cgs.media.icon_dark =  cgi_R_RegisterShader( "gfx/hud/f_icon_dark" );
    cgs.media.icon_void =  cgi_R_RegisterShader( "gfx/hud/f_icon_void" );
    cgs.media.icon_smog =  cgi_R_RegisterShader( "gfx/hud/f_icon_smog" );
    cgs.media.icon_sonic =  cgi_R_RegisterShader( "gfx/hud/f_icon_sonic" );
    cgs.media.icon_acid =  cgi_R_RegisterShader( "gfx/hud/f_icon_acid" );
    cgs.media.icon_astral =  cgi_R_RegisterShader( "gfx/hud/f_icon_astral" );
    cgs.media.icon_fireball =  cgi_R_RegisterShader( "gfx/hud/f_icon_fireball" );
    cgs.media.icon_holly =  cgi_R_RegisterShader( "gfx/hud/f_icon_holly" );
  
[

 

Each one of these have his custom Special FX, already working and registering.

Tomorrow i will set the display conditions of the icons. thanks Razor! >.<

Link to comment

Mh, i need to make some little adjustment because when i load the map, also if i have selected a playermodel with NPC name, into the mod menu, with g_char_model and ui_char_model setted, and also playermodel setted... the map load fine, the playermodel load fine, but the icons are displayed only if reload the map or if i make a save and reload.

this need some little fix. i need to study exaclty how work the loading system of JKA and how it's load the HUD icons. o.o

Link to comment

@@ensiform

Pretty funny, I am on testing this stuff of icons.

The idea of not change the array f_icon_power is pretty good.

i have simply create another const char array with another name and another set of icon powers enumerated by NUM_FORCE_POWERS sequennce.

below, on cg_init, there is the "for" block, that tell to load the icon force files.

i make two test with and if \ else statement that include this for.

basically, i tryed to make an if else by playermodels.

the command is basically "if the class of playermodel is that, load force_power_icon array called with this name" else, if the class is this other, load the default array. This works, partially... like yesterday. it load it, only after the map load, if i set playermodel and reload the map, then change the heal icon with the reborn's icon.

Otherwise... i tryed also an if \ else statement with specific NPC type named. this works pretty fine, because the NPC of the player is changed with a playermodel command inside the menu itself before the loading of a map.

the icons are changed also to the start of the level. but... but there is a strange problem of this.

If i load another map, with another model, it takes the icon of the reborn NPC.

also, if i change a map, with a different NPC model loaded at start as player character the icon of new player NPC are the same of rebornr NPC.  If i save and reload the map ... the icon of the new NPC are the same of the reborn NPC AND,  the model is misteriousy changed into the model of reborn NPC! D:

so

player->client->NPC_class = Good for save and saveloading, bad for map loading.

Player->NPC_type = "NameofNPC" = Stucked loading ever the same playermodel in every map, and the same icons set, also if i set another player and another playermodel before startup the map.

Pretty madness.

I paste here the injuring code.

 

 

 
const char    *force_icon_files[NUM_FORCE_POWERS] =
      {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_lt_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_stoneglyph",                //FP_STONEGLYPH
        "gfx/mp/f_icon_soundglyph",            //FP_SOUNDGLYPH
        "gfx/mp/f_icon_waterglyph",            //FP_WATERGLYPH
        "gfx/mp/f_icon_fireglyph",            //FP_FIREGLYPH
        "gfx/mp/f_icon_sunglyph",                    //FP_SUNGLYPH
        "gfx/mp/f_icon_windglyph",                    //FP_WINDGLYPH
        "gfx/mp/f_icon_holyglyph",                //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",                    //FP_DARKGLYPH
        "gfx/mp/f_icon_necroglyph",                    //FP_NECROGLYPH
    };

    const char    *force_icon_files1[NUM_FORCE_POWERS] =
    {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_v_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_timereaver",        //FP_STONEGLYPH
        "gfx/mp/f_icon_dimensionreaver",        //FP_SOUNDGLYPH
        "gfx/mp/f_icon_statesreaver",    //FP_WATERGLYPH
        "gfx/mp/f_icon_conflictreaver",    //FP_FIREGLYPH
        "gfx/mp/f_icon_energyreaver",            //FP_SUNGLYPH
        "gfx/mp/f_icon_mindreaver",            //FP_WINDGLYPH
        "gfx/mp/f_icon_soulreaver",            //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",            //FP_DARKGLYPH
        "gfx/mp/f_icon_bloodreaver",            //FP_NECROGLYPH
    };
    if ( player->client->NPC_class == CLASS_REBORN || player->client->NPC_class == CLASS_MONMOTHA )
    //if ( player->NPC_type = "Kain" )
    {
      for ( int i=0;i<NUM_FORCE_POWERS;i++)
      {
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files1[i] );
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
     }
    else if ( player->client->NPC_class == CLASS_LUKE )
    // else if ( player->NPC_type = "Raziel" )
    {
      for ( int i=0;i<NUM_FORCE_POWERS;i++)
      {
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files[i] );
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
     }  
     else
     {
        for ( int i=0;i<NUM_FORCE_POWERS;i++)
        {    
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files[i] );
            
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
    }

    /*CG_LoadHudMenu();      // load new hud stuff
    cgi_UI_Menu_OpenByName("loadscreen");
    //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
    memset( cg_entities, 0, sizeof(cg_entities) );
    CG_TransitionPermanent();
    cg.loadLCARSStage        = 0;
    CG_GameStateReceived();
    CG_InitConsoleCommands();*/ // COMMENTED OUT FOR AVOID LOOPING LOADGAMES.

    //
    // the game server will interpret these commands, which will be automatically
    // forwarded to the server after they are not recognized locally
    //
 
This works for load and saves, but not for loading icon on startup of the maps.

Instead:

 

 

 
const char    *force_icon_files[NUM_FORCE_POWERS] =
      {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_lt_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_stoneglyph",                //FP_STONEGLYPH
        "gfx/mp/f_icon_soundglyph",            //FP_SOUNDGLYPH
        "gfx/mp/f_icon_waterglyph",            //FP_WATERGLYPH
        "gfx/mp/f_icon_fireglyph",            //FP_FIREGLYPH
        "gfx/mp/f_icon_sunglyph",                    //FP_SUNGLYPH
        "gfx/mp/f_icon_windglyph",                    //FP_WINDGLYPH
        "gfx/mp/f_icon_holyglyph",                //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",                    //FP_DARKGLYPH
        "gfx/mp/f_icon_necroglyph",                    //FP_NECROGLYPH
    };

    const char    *force_icon_files1[NUM_FORCE_POWERS] =
    {//icons matching enums forcePowers_t
        "gfx/mp/f_icon_v_heal",        //FP_HEAL,
        "gfx/mp/f_icon_levitation",        //FP_LEVITATION,
        "gfx/mp/f_icon_speed",            //FP_SPEED,
        "gfx/mp/f_icon_push",            //FP_PUSH,
        "gfx/mp/f_icon_pull",            //FP_PULL,
        "gfx/mp/f_icon_lt_telepathy",    //FP_TELEPATHY,
        "gfx/mp/f_icon_dk_grip",        //FP_GRIP,
        "gfx/mp/f_icon_dk_l1",            //FP_LIGHTNING,
        "gfx/mp/f_icon_saber_throw",    //FP_SABERTHROW
        "gfx/mp/f_icon_saber_defend",    //FP_SABERDEFEND,
        "gfx/mp/f_icon_saber_attack",    //FP_SABERATTACK,
        "gfx/mp/f_icon_dk_rage",        //FP_RAGE,
        "gfx/mp/f_icon_lt_protect",        //FP_PROTECT,
        "gfx/mp/f_icon_lt_absorb",        //FP_ABSORB,
        "gfx/mp/f_icon_dk_drain",        //FP_DRAIN,
        "gfx/mp/f_icon_sight",            //FP_SEE,
        "gfx/mp/f_icon_stun",            //FP_STUN
        "gfx/mp/f_icon_hate",            //FP_HATE
        "gfx/mp/f_icon_controlmind",    //FP_CONTROLMIND
        "gfx/mp/f_icon_incapacitate",    //FP_INCAPACITATE
        "gfx/mp/f_icon_fear",            //FP_FEAR
        "gfx/mp/f_icon_wrack",            //FP_WRACK
        "gfx/mp/f_icon_forceglyph",        //FP_FORCEGLYPH
        "gfx/mp/f_icon_timereaver",        //FP_STONEGLYPH
        "gfx/mp/f_icon_dimensionreaver",        //FP_SOUNDGLYPH
        "gfx/mp/f_icon_statesreaver",    //FP_WATERGLYPH
        "gfx/mp/f_icon_conflictreaver",    //FP_FIREGLYPH
        "gfx/mp/f_icon_energyreaver",            //FP_SUNGLYPH
        "gfx/mp/f_icon_mindreaver",            //FP_WINDGLYPH
        "gfx/mp/f_icon_soulreaver",            //FP_HOLYGLYPH
        "gfx/mp/f_icon_darkglyph",            //FP_DARKGLYPH
        "gfx/mp/f_icon_bloodreaver",            //FP_NECROGLYPH
    };
  //  if ( player->client->NPC_class == CLASS_REBORN || player->client->NPC_class == CLASS_MONMOTHA )
    if ( player->NPC_type = "Kain" )
    {
      for ( int i=0;i<NUM_FORCE_POWERS;i++)
      {
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files1[i] );
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
     }
    //else if ( player->client->NPC_class == CLASS_LUKE )
     else if ( player->NPC_type = "Raziel" )
    {
      for ( int i=0;i<NUM_FORCE_POWERS;i++)
      {
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files[i] );
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
     }  
     else
     {
        for ( int i=0;i<NUM_FORCE_POWERS;i++)
        {    
            if (force_icon_files[i])
            {
                force_icons[i] = cgi_R_RegisterShaderNoMip( force_icon_files[i] );
            
            }
        }
        CG_LoadHudMenu();      // load new hud stuff
        cgi_UI_Menu_OpenByName("loadscreen");
        //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
        memset( cg_entities, 0, sizeof(cg_entities) );
        CG_TransitionPermanent();
        cg.loadLCARSStage        = 0;
        CG_GameStateReceived();
        CG_InitConsoleCommands();
    }

    /*CG_LoadHudMenu();      // load new hud stuff
    cgi_UI_Menu_OpenByName("loadscreen");
    //rww - Moved from CG_GameStateReceived (we don't want to clear perm ents)
    memset( cg_entities, 0, sizeof(cg_entities) );
    CG_TransitionPermanent();
    cg.loadLCARSStage        = 0;
    CG_GameStateReceived();
    CG_InitConsoleCommands();*/ // COMMENTED OUT FOR AVOID LOOPING LOADGAMES.

    //
    // the game server will interpret these commands, which will be automatically
    // forwarded to the server after they are not recognized locally
    //
 

 

This working  pretty fine on the startup level loading. BUT.... i not know why engine save system is stucked up on Kain icon and kain models.

Link to comment

You need to register all of them regardless.  Not check for player class there.  I told you where to load screen where you pick the right one.

 

Mmm, so is a problem of registering...  mmm ...

 

cg_init is not the correct place for registered icon. i trapped the shader inside it.  so it's wrong and i need to make in another place of cg_main.

i need to register them and to use the if\else for define who use what.

Also, i need to define if\else statements on Cg_drawforceselect and Datapadforceselect menu.

Tomorrow i check better these things.

Also, the playermodel command on MENU files is not checked. this is a bad think. >,<

the fact is in my mod i not use weaponsselectmenu and   forcepowerselectmenu before loading a map, because i set with icarus scripts these things on player on startup of level... Mmm. i need to see how works these two menus and how is coded their UI.

 

 

 

 

 

 

I

Link to comment

No is problem of not drawing the right ones.  There should be no if else statement in the above code.  It should just be both/all arrays registered always tbh.  The loading screen does not get dealt with in cg_main or in the CG_Init function itself (its one of the functions called by CG_Init which is in another file)

 

 

Playermodel isn't really checked because well... its technically a cheat sorta?  You're *supposed* to play as jaden lol.

Link to comment

No is problem of not drawing the right ones.  There should be no if else statement in the above code.  It should just be both/all arrays registered always tbh.  The loading screen does not get dealt with in cg_main or in the CG_Init function itself (its one of the functions called by CG_Init which is in another file)

 

 

Playermodel isn't really checked because well... its technically a cheat sorta?  You're *supposed* to play as jaden lol.

 

Mmm, this is getting complicated.

I will look all the codes parts where are called void cg_init and the menu icons. i need to fully understand how they are drawn on the startup of levels.

Yes, i understand that. playermodel not work because jKA is focused on an only player character. is not an RPG like KOTOR when you are T3M4 into a map and the Exiled in another. XD

Link to comment

cg_info.cpp is where the loading screen is drawn.

 

Oh, many thanks! :D i have make some progress also on cg_drawforceselect, but the icons got some drawing odd behavours...

mmm well, i need just to debug it, fix the datapad icons and the see loading screen icons on cg_info,cpp about the correct loading of icons for players. 

>.<  i am on the right way, however. The Hud central force icon works fine... the left and side scrolls are disaligned lol.

now i see cg_info.cpp.

 

if (force_icons[showPowers[i]])
        {
            endIndex = i;

            CG_DrawPic( holdX, y+yOffset, MAXLOAD_FORCEICONSIZE, MAXLOAD_FORCEICONSIZE, force_icons[showPowers[i]] );

            printedIconCnt++;
            if (printedIconCnt==MAXLOADICONSPERROW)
            {
                break;
            }

            holdX += (MAXLOAD_FORCEICONSIZE+MAXLOAD_FORCEICONPAD);
        }
    }

    return (endIndex);
}

int            loadForcePowerLevel[NUM_FORCE_POWERS];

/*
===============
ForcePowerDataPad_Valid
===============
*/
qboolean CG_ForcePower_Valid(int forceKnownBits, int index)
{
    if ((forceKnownBits & (1 << showPowers[index])) &&
        loadForcePowerLevel[showPowers[index]])    // Does he have the force power?
    {
        return qtrue;
    }

    return qfalse;
}

// Print force powers the player is using
// Two rows print if there are too many
static void CG_DrawLoadForcePowers( int forceBits )
{
    int        i,endIndex=0;
    int        iconCnt=0,rowIconCnt;

    // Count the number of force powers known
    for (i=0; i<MAX_SHOWPOWERS; ++i)
    {
        if (CG_ForcePower_Valid(forceBits, i))
        {
            iconCnt++;
        }
    }

    if (!iconCnt)    // If no force powers, don't display
    {
        return;
    }

    // Single line of icons
    if (iconCnt<=MAXLOADICONSPERROW)
    {
        CG_DrawLoadForcePrintRow("forceicons_singlerow", forceBits, iconCnt,0);
    }
    // Two lines of icons
    else
    {
        // Print top row
        endIndex = CG_DrawLoadForcePrintRow("forceicons_row1", forceBits, MAXLOADICONSPERROW,0);

        // Print second row
        rowIconCnt = iconCnt - MAXLOADICONSPERROW;
        CG_DrawLoadForcePrintRow("forceicons_row2", forceBits, rowIconCnt,endIndex+1);
    }

    cgi_R_SetColor( NULL );
}

// Get the player weapons and force power info
static void CG_GetLoadScreenInfo(int *weaponBits,int *forceBits)
{
    char    s[MAX_STRING_CHARS];
    int        iDummy,i;
    float    fDummy;
    const char    *var;

    gi.Cvar_VariableStringBuffer( sCVARNAME_PLAYERSAVE, s, sizeof(s) );

    // Get player weapons and force powers known
    if (s[0])    
    {
    //                |general info                  |-force powers
        sscanf( s, "%i %i %i %i %i %i %i %f %f %f %i %i",
                &iDummy,    //    &client->ps.stats[STAT_HEALTH],
                &iDummy,    //    &client->ps.stats[STAT_ARMOR],
                &*weaponBits,//    &client->ps.stats[STAT_WEAPONS],
                &iDummy,    //    &client->ps.stats[STAT_ITEMS],
                &iDummy,    //    &client->ps.weapon,
                &iDummy,    //    &client->ps.weaponstate,
                &iDummy,    //    &client->ps.batteryCharge,
                &fDummy,    //    &client->ps.viewangles[0],
                &fDummy,    //    &client->ps.viewangles[1],
                &fDummy,    //    &client->ps.viewangles[2],
                            //force power data
                &*forceBits,    //    &client->ps.forcePowersKnown,
                &iDummy        //    &client->ps.forcePower,

                );
    }
    else
    {
        // will also need to do this for weapons
        if( gi.Cvar_VariableIntegerValue("com_demo") )
        {
            gi.Cvar_VariableStringBuffer( "demo_playerwpns", s, sizeof(s) );
            
            *weaponBits = atoi(s);

        }

    }

    if( gi.Cvar_VariableIntegerValue("com_demo") )
    {
        // le Demo stuff...
        // the new JK2 stuff - force powers, etc...
        //
        *forceBits = 0; // need to zero it out it might have already been set above if coming from a true
                        // map transition in the demo
        gi.Cvar_VariableStringBuffer( "demo_playerfplvl", s, sizeof(s) );
        int j=0;
        var = strtok( s, " " );
        while( var != NULL )
        {
            /* While there are tokens in "s" */
            loadForcePowerLevel[j] = atoi(var);
            if( loadForcePowerLevel[j] )
            {
                *forceBits |= (1<<j);
            }
            j++;
            /* Get next token: */
            var = strtok( NULL, " " );
        }

    }
    else
    {
        // the new JK2 stuff - force powers, etc...
        //
        gi.Cvar_VariableStringBuffer( "playerfplvl", s, sizeof(s) );
        i=0;
        var = strtok( s, " " );
        while( var != NULL )
        {
            /* While there are tokens in "s" */
            loadForcePowerLevel[i++] = atoi(var);
            /* Get next token: */
            var = strtok( NULL, " " );
        }
    }

}

Found. thanks ^_^

Link to comment

At the end i did it! :D

now the icon are changed when i change playermodel of characters. istantly. not need to reloading level.

thanks @@ensiform for all support. :)

fixed on cg_info, cg_drawforceselect. for datapad force select, i will do the next day, when i end to make alls if \ else tree. :)

it was really complex.

it need to:

- register the new icons.

- create new array for the all icons sets of all characters.

- create new functions, like force_icons function.

- if \ else three setted inside cg_drawforceselect

- allocate on cg_init the register, where every new force_icons functions is associated to its own icon's array.

:)

I will show you how i did it when i end all icon stuff.

i suppose this can works also for description of forcepowers, with the same process.

Link to comment

Your code is way outdated it seems.  The com_demo sections were removed from OJK in June of 2014  :o

 

 

Yes, i know, i am really a "retro" person. :\

the code version is really outdated. because i building all my features on one of the firsts OpenJk versions.

i downloaded it on May-June 2013.

There is some way for update it without delete or damage every of my changes or rewrite all things into a new solution?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...