ID:158332
 
Is it possible to make it where the game can invert itself? As in for effects?
Ganing wrote:
Is it possible to make it where the game can invert itself? As in for effects?

Invert in reference to colors? Viewing direction? Controls?
In response to AJX
Invert colors =P
In response to Ganing
Ganing wrote:
Invert colors =P

AFAIK there is no functionality currently for doing that.

You could emulate this effect with icon procs, but it would be INCREDIBLY resource intensive, and should probably never ever ever ever ever ever ever ever be done.
In response to AJX
Awwww, I'm working on a Dynasty Warriors game, and I wanted the musou to be like, you click it, the screen freezes, inverts, and then a bunch of slashes appear.
Kelly McGillis: How could you see the MiG, if it was doing a negative 4g dive?

Tom Cruise: Because I was inverted.

A gold star for anyone that gets that. I'm afraid you need to clarify, your question makes no sense.
In response to AJX
If he wanted to do that he could just make another icon_state with it pre-inverted and just switch between the two.
In response to Stephen001
I've seen how people use coding to pixel art. As in, they will use that R,B,G thing. Or use HTML in the coding. I was wondering if it's possible to use something like that to make the icons invert. Like you invert with Paint, or Photoshop.
In response to Ganing
I assume this is an Icon transform for it, but I'm afraid I haven't looked. The issue is that you basically want to invert anything in view, and put it in client.screen I guess for a moment, then remove them again.
In response to Ganing
Ganing wrote:
I've seen how people use coding to pixel art. As in, they will use that R,B,G thing. Or use HTML in the coding. I was wondering if it's possible to use something like that to make the icons invert. Like you invert with Paint, or Photoshop.

See Chowder's post in this thread.

You could use separate icon states, and flip them all (in view). However if you did this, the effect would be visible to EVERYONE.
In response to AJX
It's OK if anyone can see it, but the problem is just getting it done, without having much lag. Chowder's suggestion is good, I might use it.
In response to Chowder
A single icon_state isn't ideal. I'd suggest just inverting the whole icon file and using that instead. Algorithmically, you could do it like so:

//icons to create inverted forms of
//you could pre-define it or generate it at runtime
var/list/invertables = list(
'one.dmi',
'two.dmi'
)
//the actual list containing the inverted icons
var/list/inversions = list()
//name of savefile to store inverted icons in
var/const/INVERT_SAVE = "invertedicons.save"

world/New()
..()
//load our inverted icons
if(fexists(INVERT_SAVE))
var/savefile/F = new(INVERT_SAVE)
F["inversions"] >> inversions
//find any new icons we need to create an inverted copy of
for(var/v in invertables - inversions)
invert_icon(v)

world/Del()
//save our inverted icons
var/savefile/F = new(INVERT_SAVE)
F["inversions"] << inversions
..()

proc/invert_icon(var/icon/I)
//copy the icon, invert it, and store it in the list
var/icon/O = new(I)
O *= rgb(-1,-1,-1)
inversions[I] = O

//invert an atom's icon for time ticks
atom/proc/invert(var/time)
if(inversions.Find(icon))
var/oldicon = icon
icon = inversions[icon]
spawn(time)
icon = oldicon
In response to Stephen001
Top Gun
In response to Garthor
Garthor wrote:
> proc/invert_icon(var/icon/I)
> //copy the icon, invert it, and store it in the list
> var/icon/O = new(I)
> O *= rgb(-1,-1,-1)
> inversions[I] = O


That initially looks like clever thinking, but unfortunately there's no way that would ever work.
First, you'd actually get a type mismatch error on the *= line because O is an /icon object, not an icon file, and icon arithmetic only works with the latter. Of course, this one could be remedied in many different ways; use O.icon, or use O.Blend() instead, or you could even skip creating an /icon object entirely by being sneaky and calling the undocumented _dm_new_icon()([link]) proc directly to create only a new icon file.
The other problem though is that you can't multiply an icon by rgb(-1,-1,-1) to invert it because... well, it's an invalid RGB value, and it'd probably just give you black (0,0,0) instead or something.
Thankfully, there's still a way to do this since the icon.MapColors() was made for just this purpose, special color effects. O.MapColors(-1,0,0,0,-1,0,0,0,-1,1,1,1) should invert the color.
In response to Kaioken
Yeah, sorry. I knew it was wrong but I just didn't have the time to figure out exactly what to do at the time, and wanted to post the point of it (caching the icons) before I had to go. Thanks for giving the explanation on how to do the actual inverting of the icons, though.

In retrospect, I should've just put "Figure it out yourself" in a comment there.
In response to Stephen001
Stephen001 wrote:
Kelly McGillis: How could you see the MiG, if it was doing a negative 4g dive?

Tom Cruise: Because I was inverted.

Does Pizza Hut deliver to the Danger Zone?
In response to Mobius Evalon
Perhaps, let's hope they haven't lost the edge.
In response to Ganing
http://www.byond.com/developer/forum/?id=475604
Easy peasy nice and cheesy.
[EDIT]Crispy was smoking something bad that day. Best to just follow Kaioken's example and use MapColors()
http://www.byond.com/developer/Metamorphman/MapColorsDemo