14-10-19, 18:11 | #581 |
Moderator
Joined: Dec 2011
Posts: 4,881
|
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. |
14-10-19, 18:21 | #582 | |
Member
Joined: Mar 2019
Posts: 687
|
Quote:
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) 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. |
|
14-10-19, 18:57 | #583 |
Moderator
Joined: Dec 2011
Posts: 4,881
|
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? |
14-10-19, 19:17 | #584 |
Member
Joined: May 2010
Posts: 1,187
|
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. |
14-10-19, 19:20 | #585 |
Member
Joined: Mar 2019
Posts: 687
|
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. |
15-10-19, 19:07 | #586 |
Member
Joined: Jul 2007
Posts: 288
|
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); 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); |
15-10-19, 19:49 | #587 |
Member
Joined: Mar 2019
Posts: 687
|
@Delta:
im not using the PrintText and it's implemented by TRNG so but AkyV can help you with that |
15-10-19, 20:59 | #588 |
Moderator
Joined: Dec 2011
Posts: 4,881
|
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. |
15-10-19, 21:19 | #589 | ||||
Moderator
Joined: Dec 2011
Posts: 4,881
|
Quote:
First of all, you need a new callback of CB_PROGR_ACTION_DRAW_MINE - I called mine cbDrawBasic: Quote:
Quote:
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:
|
||||
15-10-19, 22:41 | #590 |
Member
Joined: Jul 2007
Posts: 288
|
|
Thread Tools | |
|
|