Jump to content

Photo

Sprite CarryOver in Scripted PitWarp

2.55 Alpha 92

  • Please log in to reply
15 replies to this topic

#1 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 02:53 AM

Heyhoe-diggity-doo 

I'm trying around with a scripted PitWarp (1 screen to the same screen) just to reinitiate the screen.
...but I have problems to enable the "Sprites Carryover in Warp" Screen Flag.

I have tried many possible exppressions like:

Screen->Flags[SF_WARP] = SFW_SPRITECARRY;

or

 

Screen->Flags[SFW_SPRITECARRY];

or

 

Screen->Flags[SFW_SPRITECARRY] = 1;

or almost everything else....


But yeah...
...it doesnt change annything.


BTW
It's supposed to be used in my multichar header.
...to cycle between different zq subscreens, when switching to another character (and then reinitiate the screen)

...it's not meant for the inventory swap/exchange.
...things like counter and health/magic swap, and inventory backup/restore are already implimented (and working fine)


It's not a nessessary fuunction, for what I am trying to do.
(there are other ways).

But the subscreen position arrangement would be easier WITH this function :)



Thank ya'll, mates.

Party on!

  

Oh, yes....... I'm using 2.55 Alpha 92


Edited by Bagu, 18 September 2021 - 03:02 AM.


#2 Twilight Knight

Twilight Knight

  • Members
  • Real Name:Sven
  • Gender:Male
  • Location:The Netherlands

Posted 18 September 2021 - 05:34 AM

Is it stuff like weapons and enemies you're trying to carryover? I have no experience with this and frankly didn't know there was a flag for it, but you could always try to temporarily store the weapons/enemies in some global arrays and re-initiate them when becoming the other character.

Doing that does sound like too much of a hassle to me. If there is some cleaner way to do it, I'd be interested to know as well, since there is one part in my quest where the eweapons disappear due to a warp to the same screen and it doesn't look so good. 


  • Bagu likes this

#3 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 05:54 AM

Yeah, it's just a matter of screen items and enemy spawn
...cause I don't want a complete screen reset.
...I just want to reinitiate the screen, cause the new subscreen is applicated before scrolling, warping to the next screen.

An unrecognized/unnoticeable Pitwarp to the current screen seemed to be a good Idea.
 


Edited by Bagu, 18 September 2021 - 06:23 AM.


#4 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 06:43 AM

A ZC feature that checks writing to DMapData->ActiveSubscreen and automaticly renintiate the subscreen application, would be great.

The disguised pit warp trick would be unnessessary, in this case.



#5 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 08:10 AM

Btw

That's the Subscreen Switch code that I use.
...the warp is just supposed to reinitiate the Active Subscreen Application
...the subscreen switch works without it, but it won't aplicate the exchanged Active subscreen, untill scrolling/warping.

 

void ActSubControl()
{
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen < switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen ++;
	Screen->Flags[SF_WARP] = 4;

	for(int i = 9; i > 0; i--){//Just to delay the Warp, so the setting the flag is recognized.
                                   //other commands like Screen->Message didn't run, when placed 
                                   //before an undelayed Pitwarp. ... and I don't like "Waitframes"
                                   //in global used functions.
	    Link->PitWarp(Game->GetCurDMap(), Game->GetCurScreen());
	}	    
    }
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen > switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen --;
	Screen->Flags[SF_WARP] = 4;
	for(int i = 9; i > 0; i--){
	    Link->PitWarp(Game->GetCurDMap(), Game->GetCurScreen());	    
        }
    }
}

Everything (expecting setting the Sprite Carryover works fine.
...and I'd love to impliment this function, for an easier arrangement in the zq subscreen editor.

To initiate and read the character switch (and all other relevant functions) I use a variable switch state ("switchst").
...I lined up copied versions of my default custom subscreen (in the same order as the chars are listed in the switch state), and arranged all objects.

The code checks if the switchst's value is > or < than the value of the current active sub, and cycles it up/down...


 


Edited by Bagu, 18 September 2021 - 08:19 AM.


#6 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 10:51 AM

Since noone seems to have an idea, yet :)
...I keep arranging everything in 1 Subscreen.

...I can still create individual subscreens if someone has a solution.


 



#7 Emily

Emily

    Scripter / Dev

  • ZC Developers
  • Gender:Female

Posted 18 September 2021 - 05:44 PM

Screen flags affect warp combos, not script warps. To set flags on script warps, you need to use "WarpEx", not "PitWarp".
  • Bagu likes this

#8 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 07:35 PM

Hey thanks!
...could you give me an examplle, how to type that line correctly?
With using WarpEx instead of PitWarp.


Edited by Bagu, 18 September 2021 - 07:35 PM.


#9 Emily

Emily

    Scripter / Dev

  • ZC Developers
  • Gender:Female

Posted 18 September 2021 - 07:43 PM

Hero->WarpEx({WT_IWARP, Game->GetCurDMap(), Game->GetCurDMapScreen(), Hero->X, Hero->Y, WARPEFFECT_NONE, 0, WARP_FLAG_DONTCLEARSPRITES, Hero->Dir});

Read: "Instant Warp", "to the current dmap", "to the current screen (incl dmap offset)", "at the same x", "at the same y", "with no special effects",  "with no SFX to play", "not clearing sprites", "facing the same dir"


  • Bagu likes this

#10 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 08:09 PM

Thank you very much
...I'd check it out.


It still ignores the flag setting.
...but I think that still a matter of the WarP Flag Line.

I guess, now I have to use "WARP_FLAG_DONTCLEARSPRITES" instead of "SFW_SPRITECARRY". ...right?


Oh, just seen you edited the message
...I'll try out your changes now


Hero->WarpEx({WT_IWARP, Game->GetCurDMap(), Game->GetCurDMapScreen(), Hero->X, Hero->Y, WARPEFFECT_NONE, 0, WARP_FLAG_DONTCLEARSPRITES, Hero->Dir});

Read: "Instant Warp", "to the current dmap", "to the current screen (incl dmap offset)", "at the same x", "at the same y", "with no special effects",  "with no SFX to play", "not clearing sprites", "facing the same dir"

 

 

Well,
...now it's not respawning the enemies when switching the char (and warping)
...It's duplicating the screen enemies, on each Warp, cause it doesn't clear the sprites
but still (re)creates the screen enemies (on screen new screen init).

The BG MIDI is also restarting.

But the Flag (don't clear sprites) is working, now.


Edited by Bagu, 19 September 2021 - 06:12 AM.


#11 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 18 September 2021 - 08:38 PM

That's how my code looks currently

void ActSubControl()
{
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen < switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen ++;
	for(int i = 9; i > 0; i--){
	    Hero->WarpEx({WT_IWARP, Game->GetCurDMap(), Game->GetCurDMapScreen(), Hero->X, Hero->Y, WARPEFFECT_NONE, 0, WARP_FLAG_DONTCLEARSPRITES, Hero->Dir});	    
        }
    }
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen > switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen --;
	for(int i = 9; i > 0; i--){
	    Hero->WarpEx({WT_IWARP, Game->GetCurDMap(), Game->GetCurDMapScreen(), Hero->X, Hero->Y, WARPEFFECT_NONE, 0, WARP_FLAG_DONTCLEARSPRITES, Hero->Dir});	    
        }
    }
}

Edited by Bagu, 18 September 2021 - 08:50 PM.


#12 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 19 September 2021 - 01:35 PM

Screen flags affect warp combos, not script warps. To set flags on script warps, you need to use "WarpEx", not "PitWarp".

I thought about an altern version.
Which will requiere, that ffc 32 and side warp D are always reserved for this function.

I thought restarting BG Midi (etc) could be a general problem.
So if Screen Warp flags will only affect on warp combos
...why not using "SetSideWarp" and an ffc that turns into a Auto Sidewarp Combo (like in Mooshpit)...

so I wrote this version of the code

 

const int AUTOWARP_FFC = 32;
const int AUTOWARP_CMB = 508;


void ActSubControl()
{
    ffc warp;
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen < switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen ++;
	Screen->Flags[SFW_SPRITECARRY] = 1;
	Screen->Flags[SFW_AUTODIRECT]  = 1;
	Screen->SetSideWarp(3, Game->GetCurScreen(), Game->GetCurDMap(), 4);
	for(int i = 9; i > 0; i--){
	    ffc warp = Screen->LoadFFC(AUTOWARP_FFC);
	    warp->Data = AUTOWARP_CMB;
	    warp->Flags[FFCF_CARRYOVER] = false;	    
        }
    }
    else if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen > switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen --;
	Screen->Flags[SFW_SPRITECARRY] = 1;
	Screen->Flags[SFW_AUTODIRECT]  = 1;
	Screen->SetSideWarp(3, Game->GetCurScreen(), Game->GetCurDMap(), 4);
	for(int i = 9; i > 0; i--){
	    ffc warp = Screen->LoadFFC(AUTOWARP_FFC);
	    warp->Data = AUTOWARP_CMB;
	    warp->Flags[FFCF_CARRYOVER] = false;
        }
    }
}


But now, it's just like "Back to the original Problem"

everything works... but I can't activate the screen warp flags.

 

Screen->Flags[SFW_SPRITECARRY] = 1;

and 
 

Screen->Flags[SFW_AUTODIRECT]  = 1;

doesn't work


 


and...

Screen->Flags[SFW_SPRITECARRY] = true;
Screen->Flags[SFW_AUTODIRECT]  = true;

...won't even compile.



#13 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 19 September 2021 - 01:56 PM

Isn't there any other way to update the exchanged subscreen, without warping/scrolling?



#14 Emily

Emily

    Scripter / Dev

  • ZC Developers
  • Gender:Female

Posted 19 September 2021 - 11:32 PM

....So, yeah, kinda forgot, Screen->Flags[] is read-only. Also it's binary stuff, you need to use the `ScreenFlag()` function to read it easily. But yeah, you can't set that. Guess this won't work.

 

File a feature request on the discord for `ActiveSubscreen` updating automatically, and I'll get to it.


  • Bagu likes this

#15 Bagu

Bagu

    ...hardest working man in Hyrule

  • Members
  • Real Name:Ray
  • Gender:Male
  • Location:Germany

Posted 20 September 2021 - 03:02 AM

 

File a feature request on the discord for `ActiveSubscreen` updating automatically, and I'll get to it.

Yeah, I have to update Discord (I am an update negator ;) )...

But it would be really great.
In ths case I could use the code, like I've written it originally...
 

void ActSubControl()
{
    if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen < switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen ++;
    }
    else if(Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen > switchst){
	Game->LoadDMapData(Game->GetCurDMap())->ActiveSubscreen --;
    }
}

...very clean and simple.

 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users