Hooks

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Post Reply

Re: Hooks

Drinkinmiester
Cadet 1st Class
Posts: 136
Joined: Sun Nov 09, 2008 9:37 pm

Post by Drinkinmiester » Mon Jul 15, 2019 11:57 pm

keiranhalcyon7 wrote:
Sun Jun 30, 2019 3:36 am
Driftwood wrote:
Sun Jun 30, 2019 3:00 am
The other thought I've been tossing around lately is, could it be possible to define hull, maneuverability, ect. stats via the craft specific .ini file on a per-opt basis, overwriting whatever is stored in the EXE being called? Say in the instance you have an X-Wing utilized in the editor, but you overwrite it with the object replacer hook with something else, so it pulls the stats from the Othercraft.ini rather than the data in the EXE or the X-Wing.ini file?

Hypothetically.
I've kicked around an even more ambitious idea - based on a mission ini, overwrite in-memory info for replaced ships (stats, icons, strings) with info read from the replacement ship's .shp file. It's potentially a lot of internal structures to find and edit, though. The location of the stats should be easy enough, since these are part of the exe's data segment, but I think the strings and icons are loaded into dynamically allocated spaces.
So you could theoretically just have a flightmodels folder full of opts and then the data for the craft is pulled from an ini or shp file for each? So the only limit would be the number of craft in a mission?

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Jul 16, 2019 12:15 am

Yes, that's the dream.

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Sun Jul 21, 2019 6:53 am

Small comment concerning the current weapon hook : the default colors for the impacts are too "solid", setting the alpha to between 39 and 4F (example : 45FF0000 for a red impact) seems to produce the best visual results, don't know if you want to change the hook to use that as a default setting instead
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Jul 21, 2019 9:04 am

The Laser colors or impact colors are controlled through either the [Model]WeaponColor.txt or through the [Model].ini in a section named [WeaponColor]

They can be changed to any color with alpha you want

The default impact colours are :-

WeaponImpactColor_3100 = FF0000FF
WeaponImpactColor_3200 = FFFF0000
WeaponImpactColor_3300 = FF00FF00
WeaponImpactColor_3400 = FFFF00FF
WeaponImpactColor_3500 = FFFFFF00

I'll have to go through all the impact colors again to tweak them but thanks for the info, never really thought about using the alpha stop the colour being so solid :)

Going to test this now
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Sun Jul 21, 2019 9:28 am

I actually modified the ini myself of you wish to get them instead :-P
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Jul 21, 2019 10:29 am

If you want, I can modify the default colors used by the hook when they are not defined in WeaponColor.txt or the ini file.
Just give me the right values to use.

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Mon Jul 22, 2019 11:04 pm

I will defer to XWAU staff on this, but I think that just switching the first byte on the color from FF to 45 will resolve the issue

Example :

Code: Select all

WeaponImpactColor_3100 = 450000FF
WeaponImpactColor_3200 = 45FF0000
WeaponImpactColor_3300 = 4500FF00
WeaponImpactColor_3400 = 45FF00FF
WeaponImpactColor_3500 = 45FFFF00



Also, for sounds, I found out that under certains IFF, the game exchange the sounds and look between the rebel(red) lasers and the imperial(green) laser for turrets (it does not affect fixed weapons).
I don't know if there is a way to make a hook where we can specify whether to use the Green Laser or Rebel laser for which IFF through a setting in the ini ship file while also extending it to fixed weapons if it's possible(why I think it would be preferable to use the ini file to specify whether the craft exchange or not ? because some old republic starships that were improved to imperial standards, such as the dreadnaught class, probably used green lasers as part of the modernization, while civilian and rebel properties probably either used the original blue ammunition or the red one, depending on the craft, as such it would be nice to emulate this)

How the stock game seems behave for turret lasers and sound :
Pirate(yellow) and Imperial IFF : change all imperial laser turrets hardpoints to rebel lasers turrets
Rebel and Friendly civilians(Blue and purple, i don't know how the red "civilian" IFF act) : change all imperial laser turrets hardpoints to rebel laser turrets

How it could be possible to make the game behave :

Code: Select all

;Rebel means Rebel behavior for turrets, Imperial means Imperial Behavior
IFFReb = Rebel
IFFImp = Imperial
IFFYel = Rebel
IFFBlu = Rebel
IFFPur = Rebel
IFFRed = Rebel
In that example, it would force the Yellow(Pirate) IFF to use the rebel behavior for laser turrets(and fixed laser if extension to these is possible) instead of switching to green lasers if the original ships use rebel lasers hardpoints for turrets.

Note that if there's no way to control that behavior, then just a hook or a patch to prevent it would be nice enough
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Jul 23, 2019 8:16 am

I've been testing the impact colours as well, but I also changed the impact dat images in the animation.dat back to the original images, but greyscaled (monochrome) all of them

I think 45 (69 on the slider) might be too transparent, yellow and green you hardly see the impact

With my impact colors and in some cases I also change the color, but I went with 80 or BF (128 or 191 on the slider max = 255) and the green I left as a solid color due to it being like a fluorescent green now and is pretty transparent as is

Code: Select all

WeaponImpactColor_3100 = 80007EDB	
WeaponImpactColor_3200 = 80FF0000
WeaponImpactColor_3300 = FF55FF00
WeaponImpactColor_3400 = 804A0080
WeaponImpactColor_3500 = BFFFE700
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jul 23, 2019 3:20 pm

Rookie_One1 wrote:
Mon Jul 22, 2019 11:04 pm
Also, for sounds, I found out that under certains IFF, the game exchange the sounds and look between the rebel(red) lasers and the imperial(green) laser for turrets (it does not affect fixed weapons).
Hello,
In function L004E1760, there is this code:

Code: Select all

    ModelIndexEnum si;
    if( s_pXwaCurrentCraft->WeaponRacks[A8].Count != 0 )
    {
        dword ebp34 = 0;
        for( dword esi = 0; esi < 3; esi++ )
        {
            if( A8 >= s_ExeCraftTable[ebp3C].LaserStartRack[esi] && A8 <= s_ExeCraftTable[ebp3C].LaserEndRack[esi] )
            {
                if( s_ExeCraftTable[ebp3C].LaserTypeId[esi] == ModelIndex_288_1_18_LaserRebelTurbo || s_ExeCraftTable[ebp3C].LaserTypeId[esi] == ModelIndex_289_1_20_LaserImpTurbo )
                {
                    ebp34 = 0x01;
                }
            }
        }

        si = ebp34 != 0 ? ModelIndex_285_1_23_LaserIonTurbo : ModelIndex_284_1_22_LaserIon;
    }
    else
    {
        si = s_pXwaCurrentCraft->WeaponRacks[A8].ModelIndex;

        if( s_ExeWeaponSide[si - ModelIndex_280_1_17_LaserRebel] != 0xFF )
        {
            if( s_V0x05FE758[s_XwaObjects[A4].pMobileObject->Iff] != s_ExeWeaponSide[si - ModelIndex_280_1_17_LaserRebel] )
            {
                si = s_ExeWeaponSideModel[si - ModelIndex_280_1_17_LaserRebel];
            }
        }
    }
I think that in the second part of the code, there is the relevant code that switch the weapon type based on the IFF.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Jul 23, 2019 5:20 pm

Jeremy, could a mission ini hook be made to force a particular laser color for a particular fg, to defeat the bug in which captured ships switch laser color mid-mission?

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Wed Jul 24, 2019 5:49 am

JeremyaFr wrote:
Sun Jul 21, 2019 10:29 am
If you want, I can modify the default colors used by the hook when they are not defined in WeaponColor.txt or the ini file.
Just give me the right values to use.
Jeremy, how about defining the Default Impact Colors through a CFG file, this way people could choose which default color they perfer, instead of you having the change the hook default colors?
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Wed Jul 24, 2019 6:34 am

JeremyaFr wrote:
Tue Jul 23, 2019 3:20 pm
I think that in the second part of the code, there is the relevant code that switch the weapon type based on the IFF.
Interesting, the equivalency is in that code, but i'm not sure that the IFF are in that snippet.

Also, about the weapon color, the current impact color hook don't seem to affect the lightning effect that happens when a laser go near you without hitting you, don't know if it's possible to change it too
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Jul 24, 2019 4:10 pm

Darksaber wrote:
Wed Jul 24, 2019 5:49 am
Jeremy, how about defining the Default Impact Colors through a CFG file, this way people could choose which default color they perfer, instead of you having the change the hook default colors?
Good idea.

UPDATE
I've updated the weapon color hook to include a config file to define the default impact colors.

hook_weapon_color.cfg:

Code: Select all

; blue
WeaponImpactColor_3100 = 0xFF0000FF

; red
WeaponImpactColor_3200 = 0xFFFF0000

; green
WeaponImpactColor_3300 = 0xFF00FF00

; purple
WeaponImpactColor_3400 = 0xFFFF00FF

; yellow
WeaponImpactColor_3500 = 0xFFFFFF00
Please redownload the hook.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Wed Jul 24, 2019 5:44 pm

Again brilliant, just stops any arguments from forming everyone can have what ever color they choose, everybody happy :D

Thanks Jeremy
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Jul 24, 2019 7:00 pm

Rookie_One1 wrote:
Wed Jul 24, 2019 6:34 am
Also, about the weapon color, the current impact color hook don't seem to affect the lightning effect that happens when a laser go near you without hitting you, don't know if it's possible to change it too
I've found where the color of the weapon lighting effect is defined (in function L004F22B0). I will update the hook.

User avatar
Rookie_One1
Rebel Alliance
Posts: 1656
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Wed Jul 24, 2019 7:32 pm

Like DS said :

https://www.youtube.com/watch?v=028J8oUn71E

So only thing missing will be the IFF thing (either to adjust the how the IFF affects lasers per ship or to deactivate it),

and maybe adjust the sound hook to enable the replacement of imperial laser sounds fully with their rebels counterparts and vice-versa (example, replace, with one settings, replace rebellaser, rebellaserturbo and rebellaserstarship with empirelaser, empirelaserturbo and empirelaserstartship respectively), while also permitting to do the same for the Hyper-Space start sound (not joking, the IFF thing also affect it, albeit in a slightly different way, and only for player characters this time, either using HyperStartReb for IFF other than imperial, or HyperStartImp followed by HyperZoomImp if using IFF is imperial)

Also, funny thing I managed to find out : that IFF thing ? For turrets, ? it also affect player characters ships, but in a weird way : if it's turrets are setted to fire in a fixed setting toward the front, they act like fixed lasers (no change), if setted to act as turret (either in firing toward a target or in defense), it act the way the IFF is setted
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Jul 26, 2019 9:10 pm

UPDATE
Hello,

I've added setting the weapon lighting effect color to the weapon color hook.

XXX in WeaponLightColorXXX goes from 280 to 307. When present, this overrides the default lighting effect color. If it is set to 0, the default value will be used. You can define a different light color for all weapons.
The default light colors are defined in "hook_weapon_color.cfg".

Code: Select all

WeaponLightColor280 = FF3300
WeaponLightColor281 = FF3300
WeaponLightColor282 = 00FF33
WeaponLightColor283 = 00FF33
WeaponLightColor284 = 3333FF
WeaponLightColor285 = 3333FF
WeaponLightColor286 = 6633FF
WeaponLightColor287 = FF6633
WeaponLightColor288 = FF3300
WeaponLightColor289 = 00FF33
WeaponLightColor290 = 3333FF
WeaponLightColor291 = 6633FF
WeaponLightColor292 = FF6633
WeaponLightColor293 = FF6633
WeaponLightColor294 = FF6633
WeaponLightColor295 = FF33FF
WeaponLightColor296 = 3333FF
WeaponLightColor297 = FF3300
WeaponLightColor298 = FF66FF
WeaponLightColor299 = 0
WeaponLightColor300 = 0
WeaponLightColor301 = FF3300
WeaponLightColor302 = FF3300
WeaponLightColor303 = 00FF33
WeaponLightColor304 = 00FF33
WeaponLightColor305 = 00FF33
WeaponLightColor306 = 00FF33
WeaponLightColor307 = 0
The format of the light colors is RGB.

Please redownload xwa_hook_weapon_color.zip

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Jul 27, 2019 10:02 am

Jeremy are those values the default ingame lighting effect colors?
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jul 27, 2019 10:28 am

In the game exe the colors are defined as float values. I converted them to RGB format.

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sat Jul 27, 2019 5:45 pm

Thanks Jeremy, this is great! Besides these laser splash impact colors and these laser glow/reflection colors, can the cockpit Weapon EngeryBar Colors also be added to the hook_weapon_color.cfg file? It seems to me the "hook_weapon_color.cfg" acts like a global default file, but is trumped by any customized [Model]WeaponColor.txt/.ini files. Quite brilliant. :D
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jul 27, 2019 6:16 pm

Are you refering to the weapon energy bars that appears just above the cockpit?
To define the color, create a file named "FlightModels\[Model]WeaponColor.txt" or create a section named "[WeaponColor]" in "FlightModels\[Model].ini".

EnergyBarColorLaserHigh = ARGB color
EnergyBarColorLaserLow = ARGB color
EnergyBarColorIonHigh = ARGB color
EnergyBarColorIonLow = ARGB color

EnergyBarColorLaserHigh and EnergyBarColorLaserLow define the color of the laser energy bar.
EnergyBarColorIonHigh and EnergyBarColorIonLow define the color of the ion energy bar.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Jul 27, 2019 6:25 pm

Jeremy, I noticed you've updated the backdrop hook on Tues 30th July, could you please tell us why it was updated please :D
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Aug 04, 2019 8:04 pm

I've modified the random backdrops generator for planets in skirmish.
It was updated to avoid selecting a starfield backdrop instead of a planet backdrop, with DTM's backdrops.

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Aug 11, 2019 7:33 pm

UPDATE
Hello,
I've updated the hook_res1200 hook.
I've fixed a crash that appears when cycling target components at height resolution.

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Aug 11, 2019 8:09 pm

Thank you Jeremy!

Post Reply