Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Tomb Raider Next Generation

Reply
 
Thread Tools
Old 14-10-19, 18:11   #581
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default

I am working on a plugin feature to reload weapons if actual clips go empty. The "low" feature version only has a simple key command to do that (not spectacular, only refills the "weapon" ammo counter from the "backpack" ammo amount), but Krystian gave me reloading animations for pistols and shotgun, the "high" version should also include this. (Possible even for other weapons as well, but, not having animations for them, they will remain theoretical, untested for the release.)
I'd like to add these new anims to the Animation objects.
AkyV is online now   Reply With Quote
Old 14-10-19, 18:21   #582
TokyoSU
Member
 
TokyoSU's Avatar
 
Joined: Mar 2019
Posts: 687
Default

Quote:
Originally Posted by AkyV View Post
I am working on a plugin feature to reload weapons if actual clips go empty. The "low" feature version only has a simple key command to do that (not spectacular, only refills the "weapon" ammo counter from the "backpack" ammo amount), but Krystian gave me reloading animations for pistols and shotgun, the "high" version should also include this. (Possible even for other weapons as well, but, not having animations for them, they will remain theoretical, untested for the release.)
I'd like to add these new anims to the Animation objects.
use this for both if it's pistol/uzi
Code:
/* https://github.com/Arsunt/TR2Main/blob/b762737f1f317c0c2dd9398560d782398189c666/global/vars.h#L38 */
#define VAR(address, type)                     (*(type*)(address))            // uninitialized variable
#define VAA(address, type, length)             (*(type(*)length)(address))    // array (can be multidimensional)

#define left_arm                            VAR(0x0080DF72, StrLaraArm)
#define right_arm                           VAR(0x0080DF84, StrLaraArm)
but use only right_arm for shotgun/etc..
it contains the anim_number from weapon animation.

but i think two hand weapon are hardcoded (i'm not sure since i not recreated AnimateShotgun())

Last edited by TokyoSU; 14-10-19 at 18:23.
TokyoSU is offline   Reply With Quote
Old 14-10-19, 18:57   #583
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default

Ehmmm... it is too much for my actual knowledge.

Do you mean something here (your discoveries)?

TYPE_set_arm_info set_arm_info = (TYPE_set_arm_info)0x0042B420;

typedef void(__cdecl* TYPE_set_arm_info)(StrLaraArm* arm, short frame);

struct StrLaraArm
{
signed short *frame_base;
signed short frame_number;
signed short anim_number;
signed short lock;
signed short y_rot;
signed short x_rot; // dont change this position x_rot is there !!
signed short z_rot;
signed short flash_gun;
};

I suppose Anim number is an ABS value.
Should I try to force Anim number for both arms at the same time?
AkyV is online now   Reply With Quote
Old 14-10-19, 19:17   #584
Krystian
Member
 
Joined: May 2010
Posts: 1,187
Default

I'm saying in advance I don't know how to properly handle animations that are only applied to certain meshes (so for things like guns or flares/torch). But from my general experience on transfering external animations from other slots to LARA, you should supply the absolute animation index (since you cannot always predict what is this absolute index, it's best to use GET.pSlot->IndexFirstAnim + offset from anim0).

But this doesn't set the correct frame for the animation, you must also do this yourself. Use the Get(enumGET.Animation, AbsoluteAnimIndex, 0) and set GET.pAnimation->FrameStart as starting frame when trying to force this external animation for Lara.
Again, this is pretty general, but since this is how you do it when you want to transfer a whole animation to Lara from a different slot, I would guess you also do this in the case of these "partial animations" as for guns etc.

Last edited by Krystian; 14-10-19 at 19:20.
Krystian is offline   Reply With Quote
Old 14-10-19, 19:20   #585
TokyoSU
Member
 
TokyoSU's Avatar
 
Joined: Mar 2019
Posts: 687
Default

EDIT:
you need to get the anim_index like Krystian say but you will need to set the anim_number like this:
Get(enumGET.SLOT, enumSLOT.WEAPON_TYPE, 0);
left_arm.anim_number = GET.pSlot->IndexFirstAnim + (The Reload Animation Number from WadMerger)
Get(enumGET.ANIMATION, left_arm.anim_number, 0);
left_arm.frame_base = GET.pAnimation->FrameStart;
left_arm.frame_number = 0;
but normally it will have no effect since the animation is played via set_arm_info() and AnimatePistols/Shotgun():
Code:
TR3 Code:
void set_arm_info(StrArmInfo *arm, int frame)
{
	int anim_base;
	PISTOL_DEF *p;

	p = &PistolTable[lara.gun_type];

	anim_base = objects[p->ObjectNum].anim_index;

	if (frame < p->Draw1Anim)
		arm->anim_number = anim_base;

	else if (frame < p->Draw2Anim)
		arm->anim_number = anim_base+1;

	else if (frame < p->RecoilAnim)
		arm->anim_number = anim_base+2;

	else
		arm->anim_number = anim_base+3;

	arm->frame_base = anims[arm->anim_number].frame_ptr;
	arm->frame_number = frame;
}

Last edited by TokyoSU; 14-10-19 at 19:44.
TokyoSU is offline   Reply With Quote
Old 15-10-19, 19:07   #586
Delta
Member
 
Joined: Jul 2007
Posts: 288
Default

Hi guys, i'm doing some experiments with the plugin project trying to show some text on screen, but i keep getting stuck

Does anyone managed to get the PrintText (or PrintString) function work?
I tried to show it in the middle of the screen calling this function in cbCycleBegin:
Code:
PrintText(Trng.pGlobTomb4->ScreenSizeX / 2, Trng.pGlobTomb4->ScreenSizeY / 2, "Test String", enumFT.SIZE_ATOMIC_CHAR, enumFC.GOLD, enumFTS.ALIGN_CENTER);
or converting the coordinates in micro units:
Code:
RECT rect;
rect.left = Trng.pGlobTomb4->ScreenSizeX / 2;
rect.top = Trng.pGlobTomb4->ScreenSizeY / 2;
ConvertMicroUnits(&rect);
PrintText(rect.left, rect.top, "Test String", enumFT.SIZE_ATOMIC_CHAR, enumFC.GOLD, enumFTS.ALIGN_CENTER);
But i still cannot see the text on screen
Delta is offline   Reply With Quote
Old 15-10-19, 19:49   #587
TokyoSU
Member
 
TokyoSU's Avatar
 
Joined: Mar 2019
Posts: 687
Default

@Delta:
im not using the PrintText and it's implemented by TRNG so
but AkyV can help you with that
TokyoSU is offline   Reply With Quote
Old 15-10-19, 20:59   #588
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default

Quote:
Originally Posted by Krystian View Post
I'm saying in advance ...
Quote:
Originally Posted by TokyoSU View Post
EDIT:
you need to get the ...
Thanks, guys, Paolone's Get functions for animations have been clear also previously, but... I don't know, I do not brave enough yet to try to modify basic TR functions like using pistols or such. I suppose I will try some workaround like this, instead:
Let's suppose the Anim object of the required weapon has four animations, from Anim0 to Anim3. I place the reloading animation into Anim4 slot.
I will try a condition: if ammo amount is 0, then anim base is not Anim0 but anim base+2, so when the "starts shooting" Animation2 should be executed (anim base+2 = Anim0+2 = Anim2) for CTRL, then the reloading animation will be executed (anim base+2 = Anim2+2 = Anim4), and the ammo counter will be increased for a new clip, so the next time when the player uses CTRL, then normally Animation2 will be executed again.
(Plus, perhaps this way I can get away with those hardcoded barriers you said.)

I will tell if I could do it or not...

Last edited by AkyV; 15-10-19 at 21:43. Reason: Some spelling.
AkyV is online now   Reply With Quote
Old 15-10-19, 21:19   #589
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
Default

Quote:
Originally Posted by Delta View Post
Hi guys, i'm doing some experiments with the plugin project trying to show some text on screen, but i keep getting stuck
Hello!
First of all, you need a new callback of CB_PROGR_ACTION_DRAW_MINE - I called mine cbDrawBasic:

Quote:
GET_CALLBACK(CB_PROGR_ACTION_DRAW_MINE, 0, 0, cbDrawBasic);

void cbDrawBasic(void)
{

}
Type the code in this callback, for example:

Quote:
Get (enumGET.STRINGNG, MyData.Save.Local.TextString1, 0);
Text1 = FormatText (GET.pStringNG);
PrintText (PosX, PosY1, Text1, Size, Color, 0);
Important!
CB_PROGR_ACTION_DRAW_MINE draws the text (sprite, object) always! Including: menus, loadscreens. If you want to get rid of that, then perhaps you can tell the level builder how to use this trigger of my second plugin (AkyVMix02) in the script:

F593: TriggerGroup. Perform trigger in menu mode with <&> parameter

(For inventory, the trigger is not compatible with the ring inventory.)

And/or, you can try something with SKIP flags, like:

Quote:
Get (enumGET.INFO_LARA, 0, 0);
if ((GET.LaraInfo.SkipPhaseFlags & SKIP_GRAY_SCREEN) == false) { ... }
"Gray screen" should be the gray "pause" screen over the suspended real time game screen when menus are on.
AkyV is online now   Reply With Quote
Old 15-10-19, 22:41   #590
Delta
Member
 
Joined: Jul 2007
Posts: 288
Default

Ahhh this callback is executed during the main drawing operations, that's why i was failing before
Quote:
Originally Posted by AkyV View Post
And/or, you can try something with SKIP flags
Looks like it works perfectly with this, thanks for your help AkyV!
Delta is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 22:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.