Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Source Code] Post Processing
#11
can we change the colour changing? in any way
Reply
Thanks given by:
#12
You have the source code, you may do pretty much what ever you want with it as long as you don't release only binaries(you must include source with your release).

If you can do something is a different question, and depends entirely on your abilities :p.


@Zazz , what do you mean transparencies? If you mean pngs with alpha blending, not really. If you mean taking the characters and fading them in and out, then not really.

You get an array of pixels, after lf2 has finished drawing on the screen. Hence the title "post processing", meaning you process the pixels after lf2 is finished with it.

If you mean writing a huge water mark saying "Silva Rules" in the middle of the screen, which is transparent, then there shouldn't be any problem. Alpha blending is quite easy. I think it works something like:

pixel = [(source*alpha) + dest*(255-alpha)]/256

Source = the orginal pixel which was there.
dest = the pixel you want to put there.
alpha = the transparency value.

Might be wrong, you should probably google it if you want to implement it.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:
#13
may you pm a kinda guide on what means what?
and i should open everything with notepad (the source) to edit right?
and after i finish the editing how do i implement it?
Reply
Thanks given by:
#14
(06-09-2009, 04:32 PM)Lord Silva Wrote:  @Zazz , what do you mean transparencies? If you mean pngs with alpha blending, not really. If you mean taking the characters and fading them in and out, then not really.

You get an array of pixels, after lf2 has finished drawing on the screen. Hence the title "post processing", meaning you process the pixels after lf2 is finished with it.

If you mean writing a huge water mark saying "Silva Rules" in the middle of the screen, which is transparent, then there shouldn't be any problem. Alpha blending is quite easy. I think it works something like:

pixel = [(source*alpha) + dest*(255-alpha)]/256

Source = the orginal pixel which was there.
dest = the pixel you want to put there.
alpha = the transparency value.

Might be wrong, you should probably google it if you want to implement it.
I mean transparencies as in like, say I want to make my character semi-transparent, like a ghost. Or an energy ball that has flames coming out of it, and the flames are semi-transparent. I dunno, something like that.
~Member of the NTSD team~
[Image: sigk.png]
http://ntsd.open-board.com/
Reply
Thanks given by:
#15
I have no idea of HEX-editing or anything like that, but as far as I understand it, you can't do that, because you change it after LF2 finished drawing on the screen. Means that the programm doesn't know what is behind your char. Its like you save the screen as a bitmap and then edit it. You can't know whats behind your char, therefore you can't make it transparent.
Please correct me if it is rubbish what I am saying.

But if you want transparency, the easiest way is to delete every second pixel of your char in the normal bmp, like this:
- - - - -
- - - -
- - - - -
you understand what I mean? That looks a bit like semi-transparency. And you don#t need this complicated method for it.
Reply
Thanks given by:
#16
(06-10-2009, 12:35 PM)Reaper Wrote:  *Reaper says stuff about transparency*

This way you can only have 50% transparency (any other percentage would be a lot of calculating work).

It would me much more neat if we had real transparency.
Quote of the Day f***ing Year (Click to View)
Reply
Thanks given by:
#17
(06-10-2009, 12:35 PM)Reaper Wrote:  I have no idea of HEX-editing or anything like that, but as far as I understand it, you can't do that, because you change it after LF2 finished drawing on the screen. Means that the programm doesn't know what is behind your char. Its like you save the screen as a bitmap and then edit it. You can't know whats behind your char, therefore you can't make it transparent.
Please correct me if it is rubbish what I am saying.

But if you want transparency, the easiest way is to delete every second pixel of your char in the normal bmp, like this:
- - - - -
- - - -
- - - - -
you understand what I mean? That looks a bit like semi-transparency. And you don#t need this complicated method for it.
It might be possible if Silva were able to somehow make LF2 utilise the transparency capabilities of the PNG format.

=.= I already know that method of "transparency." Having real transparency would be so much better, which is why I asked in the first place.
~Member of the NTSD team~
[Image: sigk.png]
http://ntsd.open-board.com/
Reply
Thanks given by:
#18
Me and Reaper already said why it is "impossible", we get the array of pixels AFTER lf2 finished drawing anything. That means we don't know what is behind the character. What you are talking about, is completely irrelevant to this thread(loading pngs and using the alpha values).
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:
#19
thing that could be possibly done is, make a "daytime / night time" mode for stage (maybe not change it during a stage, but just per background id or something (the dark bgs right now still have "bright" chars)). maybe even make a state that makes calls to the dll to turn the screen blue-er or redder when a char does some move or something (just ideas, may be quite difficult to implement).



Azriel~
Reply
Thanks given by: Drahcir
#20
Meh, I guess this was kinda pointless. There aren't really any programmers on lfe/in the lf2 scene. I really don't enjoy coding those effects, and I don't even want to think about touching that code.

Anyway, here is the stuff you need to use the dll from rarara.dll :


rarara.asm:
Code:
.data
DllName db "effects.dll",0 ;dll name
Func db "draw",0 ; name of the drawing function


.data?
DllHandle dd ?
FuncHandle dd ?

.code

DllEntryPoint proc hInstDLL:DWORD, reason:DWORD, unused:DWORD


    mov eax,reason
    .if eax == DLL_PROCESS_ATTACH                                            ; Called when our dll loaded
        call DLLStartup                                                        ; Memory patches and jmp patches
        
        invoke LoadLibraryA, addr DllName
        mov DllHandle, eax
        
        invoke GetProcAddress, DllHandle, addr Func
        mov FuncHandle,eax
        
        .elseif reason == DLL_PROCESS_DETACH
        push NULL
        call PostQuitMessage

    .endif
    ret

DllEntryPoint endp

DLLStartup proc    

    invoke JmpPatch, 004229D4h, addr Draw_Shit    

    ret

DLLStartup endp

patches.inc:
Code:
.data
ds_r        dd 0041A79Ch
ds_c        dd 0043F100h

draw_r        dd 004229d9h

text db "silva",0

.data?
hDC        dd ?

.code


Draw_Shit proc
    
    pushad
    MOV EAX,DWORD PTR DS:[455608h]
    PUSH 510
    PUSH 100
    PUSH 0FFFFh
    PUSH 0
    PUSH offset text                   ;  ASCII "1670"
    PUSH EAX
    CALL draw_text
    ADD ESP,18h
    popad
    
    MOV EAX,DWORD PTR DS:[450B84h]


    JMP [draw_r]

Draw_Shit endp


draw_text proc
    
    
    var_4           = dword ptr -4
lpString        = dword ptr  4
arg_4           = dword ptr  8
arg_8           = dword ptr  0Ch
arg_C           = dword ptr  10h

                push    esi
                mov     esi, [esp+4+lpString]
                mov     eax, [esi]
                mov     edx, [eax+44h]
                push    edi
                lea     ecx, [esp+8+lpString]
                push    ecx
                push    esi
                call    edx
                mov     edi, eax
                test    edi, edi
                jl      short loc_4012FC
                mov     eax, [esp+0Ch+arg_4]
                mov     ecx, [esp+0Ch]
                push    ebx
                push    eax             ; COLORREF
                push    ecx             ; HDC
                mov        hDC, ecx
                call    ds:SetBkColor
                mov     edx, [esp+10h+arg_8]
                mov     eax, [esp+10h]
                push    edx             ; COLORREF
                push    eax             ; HDC
                call    ds:SetTextColor
                mov     ebx, [esp+10h+lpString]
                push    ebx             ; lpString
                call    ds:lstrlenA
                mov     ecx, [esp+24h]
                mov     edx, [esp+10h+arg_C]
                push    eax             ; int
                mov     eax, [esp+14h]
                push    ebx             ; LPCSTR
                push    ecx             ; int
                push    edx             ; int
                push    eax             ; HDC
                call    ds:TextOutA
                mov     edx, [esp+10h]
                mov     ecx, [esi]
                mov     eax, [ecx+68h]
                
                cmp dword ptr ds:[458428h],0 ;check if cheat is enabled
                je no_draw
                push eax
                mov eax,hDC
                push eax
                mov eax, [FuncHandle]
                call eax
                pop eax
no_draw:                
                push    edx
                push    esi
                call    eax
                mov     eax, edi
                pop     ebx
                

loc_4012FC:                             ; CODE XREF: sub_401290+17j
                pop     edi
                pop     esi

    
    ret

draw_text endp

Enjoy...

Includes a really simplistic example of how to trigger the effect. If cheat is enabled, the effect is working. If the cheat is off then nothing happens :p. If you have any specific questions about the source feel free to ask(specific questions, not just "What does all of it do?"). What I'm doing is, copying the draw text function and modifying it to call my dll. This has to be done because it is pretty much impossible to get the hDC without it. It makes a bunch of weird calls to directDraw, which is a COM interface, and is stupid :p. It's probably possible to remove all the irrelevant code from the function, but I decided to leave it:p.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)