Author Topic: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone  (Read 2530 times)

0 Members and 1 Guest are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
[Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« on: January 08, 2014, 05:56:06 pm »
Hey guys,

As it turns out the bitmapper I wrote for Worms was respectabily fast, I thought that some people would like to use it for their projects. It has ASM in it, so be sure you copy it correctly.

So first, here's the actual code. Sorry to not provide an 8xp file, but I'm posting from my phone as I have no PC for a while :/ instructions on how to use it are below it.

:~1
:For(64)
:+1
:Asm(E5)
:Copy(->r1+CamY* MapW + (CamX/2/2/2)+ MapPtr, r1*12+L6, 12)
:Asm(E1)
:End
:
:If CamX^8
:->r3
:For(r3)r
:Horizontal-
:End
:
:~1
:For(64)
:Select(+1,{->r1+CamY* MapW +(CamX/2/2/2+12)+ MapPtr} and (e^(8-r3->r4)-1 xor EFF)Asm(5D)r4Asm(45CB3B10FC6B) or {r1+1*12-1+L6->r2}->{r2})
:End
:End


At least it's more understandable than Runer's code.

So yeah, don't worry, I had a hard time copying it here too :P

How to use that thing :
  • MapW is the width of your map in bytes. It can be any unsigned 16-bit number.
  • CamX and CamY are the coordinates in pixels of the top-left pixel displayed on the screen. You'll have to make sure yourself that they won't go over MapW-96 for the former and MapH-64 for the latter.
  • MapPtr is simply a pointer to your MapW*MapH map.
  • Just to make sure, ~ is the negative sign, not to confuse with the minus sign.

Just copy-paste that bunch of code at the place in your program where drawing occurs, and since the whole screen is covered with the map, you don't need ClrDraw anymore, and don't need to maintain the map in an external buffer either. Just keep your plain map for the engine, no need to modify it for scrolling.

If you use that code in your program, it'd be cool to give me credits just for it :)

I can't really know how fast it is, since a whole physics engine runs on top of it in Worms (but it's still fast, so I thought it would be worth posting). So, since I have no PC, could someone post speed tests and/or screenshots, to see how fast it is ? Kinda like Runer did for his own bitmapper one year ago :P

Share your comments :)
« Last Edit: January 08, 2014, 05:57:15 pm by Matrefeytontias »

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #1 on: January 11, 2014, 10:22:16 am »
hey thanks, this could come in handy :)
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #2 on: January 11, 2014, 11:22:46 am »
Alright, so I took a screenshot and made a program, but really it's waaay faster on-calc ...



What you have to do is define °MapW, °MapPtr, °CamX and °CamY to the bitmap's width in bytes, the pointer to it, the X coordinate of the pixel to display to the top-left and its Y coordinate respectively, then put prgmSMOOTH where you want to draw the map. :)
« Last Edit: January 11, 2014, 11:23:29 am by Matrefeytontias »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #3 on: January 11, 2014, 12:47:21 pm »
You always blow my mind matref :P

Suggestion: Greyscale support!

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #4 on: January 11, 2014, 12:59:16 pm »
Well, you can scroll greyscale images with :
Code: [Select]
:*ptrToLayer2*->MapPtr
:prgmSMOOTH
:StorePic
:*ptrToLayer1*->MapPtr
:prgmSMOOTH
It's just mapping the grey layer to L6, copying this latter to L3 then mapping the black layer to L6. It's just going to be slow.
« Last Edit: January 11, 2014, 01:00:28 pm by Matrefeytontias »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #5 on: January 11, 2014, 04:53:51 pm »
Hey, that looks familiar... But I'm assuming yours is some combination of faster, more featured, or easier to use than my 2-year-old bitmapper?

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Free bitmapper/pixelmapper/smoothscroller for everyone
« Reply #6 on: January 12, 2014, 05:59:23 am »
Faster, not sure. More featured, well yours can't redraw the whole screen each frame nor take variables images or sizes. Easier to use, probably.