Duke4.net Forums: Abusing EVENT_SCREEN - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Abusing EVENT_SCREEN

User is offline   Danukem 

  • Duke Plus Developer

#1

Very useful event. It's no trouble to use it in the intended way, allowing the player to cancel it by pressing a button. But let's suppose I want to force the player to wait, and let's suppose we are in the middle of a level. This can be achieved by setting RETURN to 0 for a while. Game time does not pass during the event, so I can use totalclock to measure the passage of time. When the forced wait is over, RETURN can be set to 1 (either by the player or it can just be forced). So far, so good. But there are two problems:

-If the player presses a key during the forced wait, the screen flashes, even though the cutscreen stays on.
-Forcing the player to wait by setting RETURN to 0 in the event will prevent even the Esc key from working.

Does anyone have suggestions as to a better way to do this, or will there possibly be an update to allow for the event to be used the way I want?

Below is the relevant part of my code. The vars cutend end midscreen have been set in an actor's code, which has also used the startscreen command.

onevent EVENT_SCREEN
	ifvare RETURN 0
	{
		ifvarg SCREENALPHA 0    // QUICK FADEOUT
		{
			screenpal 0 0 0 SCREENALPHA
			subvar SCREENALPHA 5
		}
	}
	else ifvare RETURN 1
			setvar SCREENALPHA 255
			
	ifn midscreen NO
	{
		ifge totalclock cutend set RETURN 1 else set RETURN 0
		ife RETURN 1 set midscreen NO
		rotatesprite 160 100 65536 0 midscreen 0 0 2 0 0 xdim ydim
		break
	}

endevent

0

User is offline   Mark 

#2

I don't see it in the Wiki. Did you discover it during one of your trips through the Eduke32 code?
0

User is offline   Danukem 

  • Duke Plus Developer

#3

View PostMark., on 01 August 2018 - 03:00 PM, said:

I don't see it in the Wiki. Did you discover it during one of your trips through the Eduke32 code?


No, credit for that goes to Renegado, who discovered the event and provided some very useful code in this post some months back:

https://forums.duke4...post__p__294509
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#4

Sorry for the lack of documentation in the wiki, the new commands and events are explained in the SVN log: http://svn.eduke32.c...repname=eduke32

Like the screens from Duke 3D, EVENT_SCREEN doesn't process the inputs, it only checks if a key was pressed. RETURN is set to 1 when any key is pressed, and unless you set it to zero the screen ends. You can use totalclock as a counter (save the value of totalclock before you use startscreen).

You are setting the value of SCREENALPHA based on RETURN, however you are not taking in account you are modifying RETURN later.

This post has been edited by Fox: 01 August 2018 - 03:48 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#5

View PostFox, on 01 August 2018 - 03:45 PM, said:

Like the screens from Duke 3D, EVENT_SCREEN doesn't process the inputs, it only checks if a key was pressed. RETURN is set to 1 when any key is pressed, and unless you set it to zero the screen ends. You can use totalclock as a counter (save the value of totalclock before you use startscreen).

You are setting the value of SCREENALPHA based on RETURN, however you are not taking in account you are modifying RETURN later.


Right, and you can see that I was aware of setting RETURN to 0 to prevent the screen from ending and of using totalclock from the code I posted above.

When I get home I will check to see if setting SCREENALPHA is causing the screen flashing when the player presses inputs. It doesn't sound like there is a way to detect whether the player is pressing Esc as opposed to another key, though. I may have to reduce the time that the player is forced to watch the cutscene. I could have a counter for the player holding a key down.

EDIT: Yes, the SCREENALPHA thing was causing the flickering, thanks for help on that. All I need to do now is implement a timer for holding down a key to end the cutscene early.

This post has been edited by Trooper Dan: 01 August 2018 - 07:23 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options