Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: ACagliano on June 03, 2014, 12:53:52 pm
-
I am thinking about rebooting an old game I was working on a while back, and as I was thinking about it, something very ingenious came to me. Let's say for a minute that the game's map is done in 3/4 level greyscale. I was wondering if it would be possible to have, at some point in the game, a timer to start running, and as that timer elapses, the map actually starts to darken (i.e. the greyscale slowly becoming darker until eventually the whole map is just black). If I could do this, then how hard would it be to have the effect not occur within a certain radius around a moving player?
-
For the whole screen, just play with the contrast. It's not possible with only a part of the screen, except by successively lowering the gray level of the screen (ie making white pixels light-gray, light-gray pixels dark-gray etc), which is a very cheap solution anyway.
-
I'm gonna Pm you my idea... the contrast wouldn't work...
-
Why not just posting it here ?
-
Well i kinda wanted the reboot to be a secret, but here it is:
Idea... Zelda reboot. Once you hit a certain point in the game, you get a message telling you darkness is spreading from wherever and you need to hurry or you'll lose the light. From that point on, the world darkens slowly. But, along the way you learn a light giving spell that can remove that effect within a certain area around you.
How difficult is this to do? Also, for this to be most effective, should it be 3 or 4 level grey?
-
You could add more and more black pixels all over the screen until only the character is left.
-
You could add more and more black pixels all over the screen until only the character is left.
I was wondering about some sort of bit-masking... but I'm really not knowledgeable of the concepts involved.
-
Here, you have a byte
XXXX XXXX
bit-masking is taking only some of these bits by using a bit mask and using binary AND
_XXXX XXXX
&1111 0000
=XXXX 0000
Here, you should use OR to only turn bits to 1 if you want to darken the screen.
-
One rather cheaty way to do it that would cost no rendering time (barring a one-time cost when changing the palette) would be to place a copy of all graphics in RAM, and when changing the palette, repopulate all the graphics data from the originals, but with palette adjustments made. Due to the potentially large RAM requirement, this may not be ideal/feasible.
A more traditional way would be to alter the perceived palette in the drawing code. If you use 3-level grayscale, you might do something like this:
Lbl Light
0→D
Return
Lbl Dark
1→D
Fill(L₃,768,-1)
Return
Lbl PtOff
Pt-Off(r₁,r₂,r₃)
!If D
Pt-Off(r₁,r₂,r₃+8)ʳ
Return
End
Pt-On(r₁,r₂,r₃+8)
Return
4-level grayscale is a bit trickier, but it could look something like this:
Lbl Light
0→D
Return
Lbl Med
1→D
Return
Lbl Dark
2→D
Fill(L₆,768,-1)
Return
Lbl PtOff
!If D
Pt-Off(r₁,r₂,r₃)
Pt-Off(r₁,r₂,r₃+8)ʳ
Return
End
!If -1
Pt-Off(r₁,r₂,r₃)
Pt-On(r₁,r₂,r₃+8)
Pt-Off(r₁,r₂,[FFFFFFFFFFFFFFFF])ʳ
Pt-Change(r₁,r₂,r₃+8)ʳ
Pt-On(r₁,r₂,r₃)ʳ
Return
End
Pt-Off(r₁,r₂,r₃)ʳ
Pt-On(r₁,r₂,r₃+8)ʳ
Return
As you can see, the medium darkness logic is sort of tricky, and that may cause a noticeable slowdown in your program. I haven't looked into the other sprite drawing variants, but they'd probably have their own logical complications.
If it can be done without making them take substantially more time, the ultimate solution would be to go beyond Axe and to write a variant of the grayscale display routine for each palette. This would require no change in how graphics are drawn and little to no cost in rendering speed.
-
I normally just change the contrast, but that cause issues with HUDs not being as visible.
Also at first from the Fade to Black part of the title I thought this would be a Metallica-themed calculator project. :P
-
I normally just change the contrast, but that cause issues with HUDs not being as visible.
Also at first from the Fade to Black part of the title I thought this would be a Metallica-themed calculator project. :P
Yeah, contrast changing would be easier, but it has the drawback of making the HUDS not visible and also i can't do the sphere of the effect-removing spell.
Is there anyone here with some experience making RPG's of this style with some spare time? I have the project hosted on Bitbucket and I'd be more than happy to have anyone who wants to contribute, even just a little, help.
-
You could use appbackupscreen and gradually draw a ring around it. Just OR the gbuf with the corresponding byte in appbackupscreen (i dunno if your grayscale routine uses this as the second buffer, if it does just _InsertMem 768 bytes at the end of your program). It'll maybe cause a bit of slowdown but i don't think it'd be too bad, an extra 7 states for the OR statement (assuming your ORing it with (hl)) and another 15 t-states for the extra add statement (and maybe an extra 8 t-states if you've got to switch to shadow registers) in the main loop, but a lot of that can replace the wasted cycles if there are any in your grayscale code (i've never used grayscale, so i don't know what the fastcopy routine tends to look like).