hudmessagetime
This function is used to find how long a given hud message will take to finish displaying. It is designed to be called within a delay function immediately after the hud message command. (See examples)
#define TICUNIT 35.725 function int HudMessageTime(int type, int length, int typetime, int staytime, int fadetime) { Switch(type) { Case HUDMSG_PLAIN: return FixedMul(staytime, TICUNIT) >> 16; Case HUDMSG_FADEOUT: return FixedMul(staytime + fadetime, TICUNIT) >> 16; Case HUDMSG_TYPEON: return FixedMul(FixedMul(typetime, length << 16) + staytime + fadetime, TICUNIT) >> 16; Case HUDMSG_FADEINOUT: return FixedMul(typetime + staytime + fadetime, TICUNIT) >> 16; } return 0; }
Examples
This example loops through an array of text strings, displaying each and waiting until it is finished before moving on to the next one.
script 1 ENTER { delay(35); for (int i=0; i<10; i++) { HudMessage(s:Strings[i]; HUDMSG_TYPEON, 0, CR_RED, 1.5, 0.8, 2.0, 0.1, 0.5); delay(hudmessagetime(HUDMSG_TYPEON, strlen(Strings[i]), 0.1, 2.0, 0.5); } }
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.