DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[BUG FIX] Starry Sky Tiny Moon and Swooping Stars
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 07 Oct 2018

Topics: 87
Posts: 759
Location: Wisconsin
usa.gif

PostPosted: Sat May 21, 2011 6:33 pm
   Subject: [BUG FIX] Starry Sky Tiny Moon and Swooping Stars
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I am sure many people don't run Wolf4SDL in the insane resolutions that I do, (960x600, 1280x800), but I have noticed that the larger the resolution, the smaller the moon gets, and the stars make a stronger parabolic movement across the screen.
This is my fix for it, although it reduces the parabolic movement by adjusting the scaleFactor to its correct size.
I have noticed only one flaw so far, that on the right border side, the moon likes to go outside the border and leave a half of itself there.

In the wl_atmos.cpp file, the DrawStarSky function, add the red:

::: CODE :::

void DrawStarSky(byte *vbuf, uint32_t vbufPitch)
{
    int hvheight = viewheight >> 1;
    int hvwidth = viewwidth >> 1;

    byte *ptr = vbuf;
    int i;
    for(i = 0; i < hvheight; i++, ptr += vbufPitch)
        memset(ptr, 0, viewwidth);

    for(i = 0; i < MAXPOINTS; i++)
    {
        point3d_t *pt = &points[i];
        int32_t x = pt->x * viewcos + pt->z * viewsin;
        int32_t y = pt->y << 16;
        int32_t z = (pt->z * viewcos - pt->x * viewsin) >> 8;
        if(z <= 0) continue;
        int shade = z >> 18;
        if(shade > 15) continue;
        int32_t xx = x / z  * scaleFactor + hvwidth;
        int32_t yy = hvheight - y / z;
        if(xx >= 0 && xx < viewwidth && yy >= 0 && yy < hvheight)
            vbuf[yy * vbufPitch + xx] = shade + 15;
    }

    int32_t x = 16384 * viewcos + 16384 * viewsin;
    int32_t z = (16384 * viewcos - 16384 * viewsin) >> 8;
    if(z <= 0) return;
    int32_t xx = x / z * scaleFactor + hvwidth;
    int32_t yy = hvheight - ((hvheight - (hvheight >> 3)) << 22) / z;
    if(xx > -10 && xx < viewwidth)
    {
        int stopx = 10 * scaleFactor, starty = 0, stopy = 10 * scaleFactor;
        i = 0;
        if(xx < 0) i = -xx;
        if(xx > viewwidth - 11) stopx = viewwidth - xx;
        if(yy < 0) starty = -yy;
        if(yy > viewheight - 11) stopy = viewheight - yy;
        for(; i < stopx; i++)
            for(int j = starty; j < stopy; j++)
                vbuf[(yy + j) * vbufPitch + xx + i] = moon[j/scaleFactor * 10 + i/scaleFactor];
    }
}


It enlarges the moon, also making it travel in a straight path, also the stars will move correctly, accordingly.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 02 Jun 2018

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Sat May 21, 2011 10:12 pm
   Subject: Re: [BUG FIX] Starry Sky Tiny Moon and Swooping Stars
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

To fix the moon drawing onto the border, make this change:

::: CODE :::
if(xx < 0) i = -xx;
if(xx > viewwidth - 11 * scaleFactor) stopx = viewwidth - xx;
if(yy < 0) starty = -yy;
if(yy > viewheight - 11 * scaleFactor) stopy = viewheight - yy;


The "11" is the the width of the moon array, so this also needs to be adjusted
Thanks for figuring this out too. I knew it was a matter of plugging in scaleFactors somewhere but I've been too lazy to figure it out.

Also, I'm not sure if you saw my thread: http://diehardwolfers.areyep.com/viewtopic.php?t=5996
where I found that hardcoding certain values for drawrain and drawsnow make it so rain/snow are drawn at the correct (well somewhat correct) levels on the screen on all resolutions.
If you messed around with that at all, did you find a better way?

_________________
Steam: http://steamcommunity.com/id/stormx312
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 07 Oct 2018

Topics: 87
Posts: 759
Location: Wisconsin
usa.gif

PostPosted: Sun May 22, 2011 9:01 am
   Subject: Re: [BUG FIX] Starry Sky Tiny Moon and Swooping Stars
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

No I didn't look at the snow/rain part, but I may look into it shortly.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 07 Oct 2018

Topics: 87
Posts: 759
Location: Wisconsin
usa.gif

PostPosted: Sun May 22, 2011 9:13 am
   Subject: [BUG FIX] Starry Sky Tiny Moon and Swooping Stars
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

It almost works, except if you look closely when it gets to the far left, one spot before disappearing, it skewed the array causing the moon to appear a bunch of times with a mash of colors.

(yay pointers :/)

well, I found this to fix it:

::: CODE :::
 if(xx > -10 && xx < viewwidth)
    {
        int stopx = 10 * scaleFactor, starty = 0, stopy = 10 * scaleFactor;
        i = 0;
      if(xx < 0) { i = -xx; xx = 0; }
        if(xx > viewwidth - 11 * scaleFactor) stopx = viewwidth - xx;
        if(yy < 0) starty = -yy;
        if(yy > viewheight - 11 * scaleFactor) stopy = viewheight - yy;
        for(; i < stopx; i++)
            for(int j = starty; j < stopy; j++)
                vbuf[(yy + j) * vbufPitch + xx + i] = moon[j/scaleFactor * 10 + i/scaleFactor];
    }


I modified the original line, to simply set xx = 0, because it becomes a negative value (from what I debugged), and that doesn't fly well with the array, or evaluating the rest of the numbers

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Announcement: Wolf4SDL released
Author: Ripper
522 223934 Mon May 22, 2017 2:04 pm
Tricob View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 11808 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 3175 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3388 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 4806 Sun Apr 27, 2008 2:30 am
AlumiuN View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group