About

6/14/11

Coding: Pixel ripple effect

Obfuscated C code! This is the inner core loop of a water rippling effect, though I spent some time rearranging the code, because it looked cool for some reason. Do you get what is going on here ? :p
switch    (renderflag)          {
case      0                  :  {
for(int i=1; i < resy-1 ; i  ++ )  {
for(int j=1; j < resx-1 ; j  ++ )  {
    buf1   [ j ]     [ i     ]  =
    ((                          (
    buf2   [ j + 1 ] [ i     ]  +
    buf2   [ j - 1 ] [ i     ]  +
    buf2   [ j ]     [ i - 1 ]  +
    buf2   [ j ]     [ i + 1 ]  )
    >>                     1 )  -
    buf1   [ j ]     [ i     ] );
    buf1   [ j ]     [ i     ] -=
    buf1   [ j ]     [ i     ] >>
    7                           ;
    offsetx                     =
    buf1   [ j ]     [ i     ]  -
    buf1   [ j + 1 ] [ i     ]  ;
    offsety                     =
    buf1   [ j ]     [ i     ]  -
    buf1   [ j ]     [ i + 1 ]  ;
    _putpixel(  water, j , i   ,(
    128      -  offsetx        )&
    255                        );
    offsetx                   >>=
    8        ;  offsety       >>=
    8                           ;
    indexu   =  offsetx  + j    ;
    indexv   =  offsety  + i    ;
    if       (  indexu         >=
    resx     )  indexu         -=
    resx                        ;
    else if  (  indexu   < 0    )
    indexu                     +=
    resx                        ;
    if       (  indexv         >=
    resy     )  indexv         -=
    resy                        ;
    else if  (  indexv   < 0    )
    indexv                     +=
    resy                        ;
    _putpixel(  vscreen  , j    ,
    i                         ,((
    _getpixel(  backdrop        ,
    indexu                      ,
    indexv   )                 <<
    8                          )+
    _getpixel(  water, j , i   ))
    >>                     8   );
    }}}         break           ;
case 1                         :{
for(int i=1; i < resy-1 ; i  ++ )  {
for(int j=1; j < resx-1 ; j  ++ )  {
    buf2   [ j ]     [ i     ]  =
    ((                          (
    buf1   [ j + 1 ] [ i     ]  +
    buf1   [ j - 1 ] [ i     ]  +
    buf1   [ j ]     [ i - 1 ]  +
    buf1   [ j ]     [ i + 1 ]  )
    >>                     1 )  -
    buf2   [ j ]     [ i     ] );
    buf2   [ j ]     [ i     ] -=
    buf2   [ j ]     [ i     ] >>
    7                           ;
    offsetx                     =
    buf2   [ j ]     [ i     ]  -
    buf2   [ j + 1 ] [ i     ]  ;
    offsety                     =
    buf2   [ j ]     [ i     ]  -
    buf2   [ j ]     [ i + 1 ]  ;
    _putpixel(  water, j , i   ,(
    128      -  offsetx        )&
    255                        );
    offsetx                   >>=
    8        ;  offsety       >>=
    8                           ;
    indexu   =  offsetx  + j    ;
    indexv   =  offsety  + i    ;
    if       (  indexu         >=
    resx     )  indexu         -=
    resx                        ;
    else if  (  indexu   < 0    )
    indexu                     +=
    resx                        ;
    if       (  indexv         >=
    resy     )  indexv         -=
    resy                        ;
    else if  (  indexv   < 0    )
    indexv                     +=
    resy                        ;
    _putpixel(  vscreen  , j    ,
    i                         ,((
    _getpixel(  backdrop        ,
    indexu                      ,
    indexv   )                 <<
    8                          )+
    _getpixel(  water, j , i   ))
    >>                     8   );
    }}}         break           ;
    default:    break;          }

Tab: Soulshimmer

"Soulshimmer" - Written by me ca. anno. 2006


EM

------0---0-----------0---------------
------0---0-----------0---------------
---0----0---0-------0------0----------
------------------2-------------------
-------------------------2------------
-0------------------------------------

C

------0---0-------
------1---1-------
---0----0---0-----
------------------
--3---------------
------------------


C
------0---0-------
------1---1-------
---0----0---------
------------------
--2----------0----
---------------3--




G
------3---3~~-----
------0---0h1-----
---0----0---------
------------------
------------------
--3---------------

------3---3~~-----
------0---1p0-----
---0----0---------
------------------
------------------
--3---------------

------3---3~~-----
------3---3-------
---0----0----0----
------------------
------------------
--3---------------

------3---3~~-----
------3---3p0-----
---0----0----0----
------------------
------------------
--3---------------



------------------
------------------
------------------
------------------
------------------
---2b3b2----------




---------0-----0---h----
---------12----12--10---
------12----12-12--11---
------------------------
------------------------
--0---------------------


---------0-----0--------
---------10----10-s-8---
------11----11-11-s-9---
------------------------
------------------------
--0---------------------


---------0----0---------
---------8----8-s-7-----
------9----9--9---8-----
------------------------
------------------------
--0---------------------


---------0-----0--------
---------8-----0--------
------9----9------------
------------------------
------------------------
--0---------------------

6/12/11

Games: PS2 games

Here's our stack of PS2 games.

Unfortunately, we have one of the last PS2 Slimline's to ever be produced, and it does not allow for any chipping or anything. If you have a recent PS2 SL, check your model number before you attempt to get it chipped!

Some good PS2 games: Spiderman 2, Matrix Path of Neo, GTA: Vice City. Psyvariar, Mobile Light Force, and the SEGA MegaDrive Collection wich has 20-25 retro games!