SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > SRB2 Discussion > Bug Reports

Reply
 
Thread Tools Search this Thread
Old 01-19-2017   #1
Prisima the Fox
*inaudible crawling noises*
 
Prisima the Fox's Avatar
Default Freeslotting sprites doesn't work inside of functions.

If you freeslot a sprite inside of a function, like this:
Code:
addHook("ThinkFrame", do
	if not _G["SPR_ABC1"]
		freeslot("SPR_ABC1")
	end
	for p in players.iterate
		if _G["SPR_ABC1"]
			p.mo.sprite = SPR_ABC1
		end
	end
end)
you get an error (in addition to the sprite not being displayed):
Code:
ERROR: R_ProjectSprite: invalid sprite frame 0/0 for ABC1
But if you freeslot the sprite outside of the function, like this:
Code:
freeslot("SPR_ABC1")

addHook("ThinkFrame", do
	for p in players.iterate
		p.mo.sprite = SPR_ABC1
	end
end)
everything is fine, the sprite displays, and no errors occur.
__________________
Quote:
*PrisimaAce* left the synch (Game failure)

Last edited by Monster Iestyn; 4 Days Ago at 12:57 AM.
Prisima the Fox is offline   Reply With Quote
Old 01-20-2017   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

This is because the sprite prefix doesn't exist when the WAD containing the sprites is loaded (I assume they're in the same WAD as the script here), so the game never thinks to load the lumps with the sprite prefix at all. Freeslotting the sprite after the game has already loaded the WAD won't cause the game to look again in it for sprite lumps.

Probably got some details wrong but it's really because the freeslotting doesn't take place on WAD load.
Monster Iestyn is offline   Reply With Quote
Old 01-21-2017   #3
RedEnchilada
happy, pretty, lovely!
Developer
 
RedEnchilada's Avatar
Default

Why are you trying to use a sprite freeslot in a hook anyway?
__________________
Quote:
<@toaster> '"sonic robot explosion 2", the hot new sensation for teens looking for a good time, tempts many children away from god each year'
RedEnchilada is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Forum Jump


All times are GMT. The time now is 05:30 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.