davidjoffe / dave_gnukem

Dave Gnukem is a cross-platform 2D scrolling platform shooter inspired by Duke Nukem 1
GNU General Public License v2.0
76 stars 24 forks source link

GFX color glish #100

Closed BeWorld2018 closed 6 years ago

BeWorld2018 commented 6 years ago

Hi I try to compile on my MorphOS (Amiga Os Comppatible) system, all ok but i have a bug with color.

My machine is an PowerPC processor.

Can you manage SDL_BIG_ENDIAN in your code ?

Thanks you

davidjoffe commented 6 years ago

Hi! Thanks for reporting this, any chcne you could attach either a screenshot or say maybe a quick photo taken with your phone if that's easier? (It may or may not be an endianness problem)

BeWorld2018 commented 6 years ago

Hi,

ok i join 2 screenshot and log.... thank you for your help

grab grab2

DaveGnukem.log

davidjoffe commented 6 years ago

Thanks! Looks great to me, I don't see a problem :D .. just kidding .. I'll study this and have a look.

One thing that strikes me as odd is it looks like you are somehow using an old/outdated data folder (though I can tell from the "v0.91" that the source code is very recent) - that "This game is in beta" message in the lower left was removed many months ago, probably about a year ago - I don't quite understand how you've ended up with that there. (If it's only the data folder that's old then I can't think that that would be causing the bad colors, but if you are somehow also using older parts of some of the source code then it could explain bad colors, as I did re-write how some of the texture/bitmap stuff works.)

Edit To be clear, the "This game is in beta" message was removed long ago from "gameskin.tga" (the in-game background), however, it has not yet been removed from the main menu background skin.

BeWorld2018 commented 6 years ago

ok after some test i found the bug :-) or origine of this glish

on djgraph.cpp function djCreateImaheHWSurface SDL_CreateRGBSurfaceFrom(

i put this at en end 0xFF000000, 0X00FF0000, 0x0000FF00, 0x000000FF); And Color are corrects !

I compile your game and i publish it for MorphOS users :-)

davidjoffe commented 6 years ago

OK problem solved - preliminary testing does suggest this is simply an endianness issue - also, it solves the problem of what I thought was the old data folder, ha ha! What is happening, I think, is that after you start the game, it renders the game skin, but now onylwith partial transparency, because of the endianness, and therefore the main menu's "This game is in beta" message doesn't get drawn over 100%, it partly remains behind - I think that is what's happening. Thank you again for reporting this, I will just have to see where the correct fix belongs exactly. Maybe an #ifdef PPC or something along those lines.

BeWorld2018 commented 6 years ago

thanks you :-)

davidjoffe commented 6 years ago

Would appreciate if you can let me know if making it like so works:

SDL_Surface* pSurfaceFoo = ::SDL_CreateRGBSurfaceFrom(
    pImage->Data(),
    pImage->Width(),
    pImage->Height(),
    32,
    pImage->Pitch(),
    // R,G,B,A masks:
    #if SDL_BYTEORDER==SDL_BIG_ENDIAN
    0xFF000000, 0X00FF0000, 0x0000FF00, 0x000000FF
    #else
    0xFF0000,
    0xFF00,
    0xFF,
    0xFF000000
    #endif
);

(I am not sure if this is the correct place to solve this, maybe the TGA loader should be reversing etc. I suspect there may be other parts of the code that don't quite render now with correct colors.)

davidjoffe commented 6 years ago

I've in the meantime committed a fix to the source based on the above. Can adapt if/as necessary.

BeWorld2018 commented 6 years ago

Hi Real fix is :

if SDL_BYTEORDER==SDL_BIG_ENDIAN

0x0000FF00, 0X00FF0000, 0xFF000000, 0x000000FF

Thanks

davidjoffe commented 6 years ago

Thanks! I've committed a new fix based on your suggestion (unfortunately I can't easily test it myself as I don't have any big-endian systems or VMs at hand)

davidjoffe commented 6 years ago

If you're making some sort of package or something for MorphOS, please feel free to drop me a link if possible, I can add a link from the Readme etc. under Ports

BeWorld2018 commented 6 years ago

Hi

You can find MorphOS exe :

If you see any problem on archive, tell me.

Thanks.

BeWorld

De : David Joffe notifications@github.com Envoyé : mardi 20 mars 2018 23:52 À : davidjoffe/dave_gnukem dave_gnukem@noreply.github.com Cc : BeWorld2018 bruno.peloille@neuf.fr; Author author@noreply.github.com Objet : Re: [davidjoffe/dave_gnukem] GFX color glish (#100)

If you're making some sort of package or something for MorphOS, please feel free to drop me a link if possible, I can add a link from the Readme etc. under Ports

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidjoffe/dave_gnukem/issues/100#issuecomment-374784191 , or mute the thread https://github.com/notifications/unsubscribe-auth/AjHizwaVW8FTwkhRlAW5qMdGwR4zp6fAks5tgYfygaJpZM4SuIfe . https://github.com/notifications/beacon/AjHiz53UWSumnqa7N9PtInDyhNkz2GR7ks5tgYfygaJpZM4SuIfe.gif

davidjoffe commented 5 years ago

There may still be something else wrong here; macppc OpenBSD users reported having to seemingly (as I interpret it) undo this fix, to get it working on OpenBSD macppc, or they get blank screen ... see here for more info:

http://openbsd-archive.7691.n7.nabble.com/NEW-games-gnukem-td365426.html

NB: I can't incorporate Raphael Graf's OpenBSD macppc patch without breaking it again on MorphOS - so this needs further investigation as to what exactly is going on, and the most 'correct' way to fix it.

davidjoffe commented 1 year ago

I'm currently making some changes that maaaay risk these issues resurfacing - if you notice problems again in future like this let me know