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       

Enabling Tab-O (using VSWAP images as Tile16Ms)
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
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Sat May 07, 2011 9:45 pm
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hey, remember this feature that worked in the Alpha version using F10-O?



I thought it would be fun to "revive" this feature in SDL today. Smile
How? Well, the code for drawing vswap images is already here, you just have to throw it into TileM16s!

So if you want to give it a shot, just open up wl_debug.cpp and remove this:

::: CODE :::
/*
=============================================================================

                                                 LOCAL CONSTANTS

=============================================================================
*/

#define VIEWTILEX       (viewwidth/16)
#define VIEWTILEY       (viewheight/16)

Then change the "O" key to do this:

::: CODE :::
    else if (Keyboard[sc_O])        // O = basic overhead
    {
        ViewMap();

        return 1;
    }

Then remove the OverheadRefresh() and ViewMap() functions, and replace them with something like this:

::: CODE :::
//#if 0
/*
===================
=
= OverheadRefresh
=
===================
 */

int xstart, ystart, VIEWTILEX, VIEWTILEY;
int rotateActor[9] = {6,5,4,3,2,1,0,7,0};
int TileMSize, pixelSize, floorSize, TileMMapRatio, TileMWallRatio;

#define col_floor   25  // Gray Floor
#define col_secret  9   // Blue Floor

#define spr_start   23
#define spr_end     71  // Last sprite in wolf3d (Vines)


void TileMFloor(unsigned sx, unsigned sy, byte color)
{
    VWB_BarScaledCoord(sx, sy, floorSize, floorSize, color);
}

void TileMWall(unsigned sx, unsigned sy, unsigned pagenum)
{
    uint8_t *start;
    start = PM_GetPage(pagenum);

    for (int x=0;x<TileMSize;x++)
    {
        for (int y=0;y<TileMSize;y++)
        {
            VWB_BarScaledCoord((sx+x*pixelSize),(sy+y*pixelSize),pixelSize,pixelSize,(int)*start);
            start = start + TileMWallRatio;
        }

        start = start + TEXTURESIZE*(TileMWallRatio-1);
    }
}

void TileMDoor(unsigned sx, unsigned sy, byte doornum)
{
    int doorpage;
    #define DOORWALL (PMSpriteStart-8)

    if (doorobjlist[doornum].action == dr_open)
    {
        TileMFloor(sx,sy,col_floor);
        return;
    }

    switch(doorobjlist[doornum].lock)
    {
        case dr_normal:
            doorpage = DOORWALL;
            break;
        case dr_lock1:
            doorpage = DOORWALL+7;
            break;
        case dr_lock2:
        case dr_lock3:
        case dr_lock4:
            doorpage = DOORWALL+6;
            break;
        case dr_elevator:
            doorpage = DOORWALL+5;
            break;
        }

    TileMWall(sx,sy,doorpage);

}

void TileMSprite(unsigned sx, unsigned sy, int pagenum)
{
    t_compshape   *shape;
    unsigned starty,endy,lpix;
    word *cmdptr;
    byte *line, col;
    short newstart;

    shape = (t_compshape *) PM_GetSprite(pagenum);
    cmdptr=shape->dataofs;

    for(lpix=shape->leftpix;lpix<=shape->rightpix;lpix++,cmdptr++)
    {
        line = (byte *)shape + *cmdptr;

        while((endy = READWORD(line)) != 0)
        {
            endy >>= 1;
            newstart = READWORD(line);
            starty = READWORD(line) >> 1;

            for(;starty<endy;starty++)
            {
                if (lpix%TileMWallRatio==0 && starty%TileMWallRatio==0)
                {
                    col=((byte *)shape)[newstart+starty];
                    VWB_BarScaledCoord(sx+(lpix/TileMWallRatio)*pixelSize,sy+(starty/TileMWallRatio)*pixelSize,pixelSize,pixelSize,col);
                }
            }
        }
    }
}

void SetupMapDefaults ()
{
    if (Keyboard[sc_2])
    {
        // Add detail
        if (scaleFactor < 4)        TileMSize = 32;
        else                        TileMSize = 64;

        pixelSize = 1;
    }
    else if (Keyboard[sc_3])
    {
        // Zoom Out
        if (scaleFactor == 1)       TileMSize = 8;
        else if (scaleFactor < 4)   TileMSize = 16;
        else                        TileMSize = 32;

        pixelSize = 1;
    }
    else if (Keyboard[sc_4])
    {
        // Zoom In
        if (scaleFactor < 4)        { TileMSize = 64;   pixelSize = 1; }
        else if (TEXTURESIZE == 128){ TileMSize = 128;  pixelSize = 1; }
        else                        { TileMSize = 64;   pixelSize = 2; }
    }
    else if (Keyboard[sc_5])
    {
        // Basic Overhead
        TileMSize = 1;
        BasicOverhead();
        IN_ClearKeysDown();
        return;
    }
    else
    {
        // Default Setting (TileM16s)
        TileMSize = 16;
        pixelSize = scaleFactor;
    }

    VIEWTILEX = viewwidth/(TileMSize*pixelSize);
    VIEWTILEY = viewheight/(TileMSize*pixelSize);

    if (VIEWTILEX > MAPSIZE) VIEWTILEX = MAPSIZE;
    if (VIEWTILEY > MAPSIZE) VIEWTILEY = MAPSIZE;

    TileMMapRatio  = MAPSIZE/TileMSize;
    TileMWallRatio = TEXTURESIZE/TileMSize;

    floorSize = pixelSize*TileMSize;

    if (viewsize>19) { xstart = ystart = 0; } else
    {
        xstart = (screenWidth-viewwidth)/2;
        ystart = (screenHeight-STATUSLINES*scaleFactor-viewheight)/2;
    }

}


void OverheadRefresh (void)
{
    unsigned        x,y,endx,endy,sx,sy;
    unsigned        tile;

    endx =  maporgx+VIEWTILEX;
    endy =  maporgy+VIEWTILEY;

    for (y=maporgy;y<endy;y++)
    {
        for (x=maporgx;x<endx;x++)
        {
            sx = (x-maporgx)*floorSize + xstart;
            sy = (y-maporgy)*floorSize + ystart;

            switch (viewtype)
            {
#if 0
                case mapview:
                    tile = *(mapsegs[0]+farmapylookup[y]+x);
                    break;

                case tilemapview:
                    tile = tilemap[x][y];
                    break;

                case visview:
                    tile = spotvis[x][y];
                    break;
#endif
                case actoratview:
                    tile = (unsigned)actorat[x][y];
                    break;
            }

            if (tile && tile < MAXWALLTILES)
            {
                // Draw Wall
                if (Keyboard[sc_Tab] && MAPSPOT(x,y,1) == PUSHABLETILE)
                    TileMFloor(sx,sy,col_secret);
                else
                    TileMWall(sx,sy,(tile*2-2));
            }
            else if (tile && tile < MAXWALLTILES*4 && tile != MAXWALLTILES)
            {
                // Draw Door
                TileMDoor(sx, sy, (tile - MAXWALLTILES*2));
            }
            else
            {
                // Draw Floor
                if (Keyboard[sc_F])
                    TileMFloor(sx,sy, (MAPSPOT(x,y,0)-AREATILE));
                else
                    TileMFloor(sx,sy,col_floor);

                if (tile == MAXWALLTILES || (Keyboard[sc_Tab] && (MAPSPOT(x,y,1) >= spr_start && MAPSPOT(x,y,1) <= spr_end)))
                {
                    // Draw Sprite
                    TileMSprite(sx,sy,(MAPSPOT(x,y,1)-(spr_start-2)));
                }
                else if (tile)
                {
                    // Draw Actor
                    objtype *obj  = (objtype *)((uintptr_t)tile);
                    int shapenum = ((statetype *)obj->state)->shapenum;
                    if (obj->state->rotate) shapenum += rotateActor[obj->dir];

                    TileMSprite(sx,sy,shapenum);
                }
            }
        }
    }

    VW_UpdateScreen();

    if (Keyboard[sc_P])
        PictureGrabber();

}
//#endif

//#if 0

/*
===================
=
= ViewMap
=
===================
*/

void ViewMap (void)
{
    boolean         button0held;

    SetupMapDefaults();
    if (TileMSize == 1) return;


    viewtype = actoratview;
    //      button0held = false;


    maporgx = player->tilex - VIEWTILEX/2;
    if (maporgx<0)
        maporgx = 0;
    if (maporgx>MAPSIZE-VIEWTILEX)
        maporgx=MAPSIZE-VIEWTILEX;
    maporgy = player->tiley - VIEWTILEY/2;
    if (maporgy<0)
        maporgy = 0;
    if (maporgy>MAPSIZE-VIEWTILEY)
        maporgy=MAPSIZE-VIEWTILEY;

    do
    {
        //
        // let user pan around
        //
        PollControls ();
        if (controlx < 0 && maporgx>0)
            maporgx--;
        if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
            maporgx++;
        if (controly < 0 && maporgy>0)
            maporgy--;
        if (controly > 0 && maporgy<mapheight-VIEWTILEY)
            maporgy++;

#if 0
        if (c.button0 && !button0held)
        {
            button0held = true;
            viewtype++;
            if (viewtype>visview)
                viewtype = mapview;
        }
        if (!c.button0)
            button0held = false;
#endif


        OverheadRefresh ();

     } while (!Keyboard[sc_Escape]);


    IN_ClearKeysDown ();
}
//#endif
#endif

You can use these special key combinations to take advantage of higher SDL resolutions:

Tab-O - default, shows Tile16s scaled to 320x200 (example)
(Tab-2)-O - mode 2: add detail (based on resolution) (example)
(Tab-3)-O - mode 3: zoom out (adding detail) (example)
(Tab-4)-O - mode 4: zoom in (adding detail) (example)
(Tab-5)-O - mode 5: BasicOverhead()

And here's some more special keys you can hold down for extra stuff:

TAB - Show mapsegs[1] data (all non-blocking sprites, secret passages)
F - Show Floors (first 16 floors show up as the EGA palette)
P - Print Screen (unless Windows Vista/7 has limited permissions for this folder)

More random notes:

* This code works with 128x128 maps/textures too, on Wolf4SDLv1.6 and also revision 255
* When you use the Change View option (F5), the overhead map will fit itself into the border (sexy!)
* If you want to actually buffer the overhead to go faster while scrolling, you could make a lasttile[TileMSize][TileMSize] that saves and loads when the previous/next tile is the same, and/or you can make a oldmapview[VIEWTILEX][VIEWTILEY] that checks if the wall after you move in a direction is the same as before and not display it
* Sometimes a guard will leave two death spots. This is useful to know if you're pressing a secret passage towards them
* Displaying mapsegs[1] with TAB is a lot easier than scanning the objectlist for static objects, mapsegs[1] basically exists so that when you die all that stuff will come back if you already picked it up, but if you want to do the objlist scan thing instead...
* Gold Doors show up as the dark shade (dark gray), Silver Doors as the light shade (white)
* This code is all customizable, change anything you want... I'm not your mother!
* What else... I think I forgot to mention something important... maybe not... oh well...

Tada! Piece of cake. Now lets try something difficult... like making Kraft Dinner (I suck at it!). Laughing
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat May 07, 2011 10:30 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Cool stuff! Very Happy How does it work with your 1024 Walls code? I already have that routine put in my Open Source package.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Sun May 08, 2011 10:59 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
How does it work with your 1024 Walls code? I already have that routine put in my Open Source package.

Hey Tricob, glad you found that MAXWALLTILES/MAXDOORS topic useful. Smile
What is your Open Source package all about? A collection of different tutorials? Sounds interesting.

Ok, I just tested your question... and yes, the two codes are already compatible. This is because they both use the original wolf3d idea of bits to determine if the tile is a wall (< MAXWALLTILES), door (>= MAXWALLTILES*2 && < MAXWALLTILES*4), blocking sprite (== MAXWALLTILES), or actor (> MAXWALLTILES*4), and because this Tab-O code uses PMSpriteStart to look for the door (PMSpriteStart - 8.) and sprite textures, which it can find regardless of how many walls you add to the vswap.

I merged the two codes together here, though, if you want to test it or play around with them:

http://choksta.webs.com/bitshift.rar

OT - Heh... one thing I just noticed, is that the Pistol on the status bar is like twice as huge on the Alpha version. Laughing
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun May 08, 2011 4:39 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris wrote:
What is your Open Source package all about? A collection of different tutorials? Sounds interesting.
Its current title is "Base Of Operations". It pretty much picks up where BT's "BunkerSDL source code" left off, using various tutorials over the years, along with a few on my own. It also uses some "Smart Level" code, where it calculates percentages based on how many levels have Par Times, rather than having to change this code every time the number of levels changes. The code doesn't calculate percentages for levels the player hasn't gone through, so it's ideal for running Wolf3D/SOD mapsets with less than 21 or 60 levels.

I also rewrote some of the code so that adding and changing Par Times, in-game music, in-game messages, and Ceiling Colors isn't so heavy-handed (You change all these through H files now, not CPP files). All of the SDL bugfixes I've posted over the years are in this source code package, and a fellow Wolfer has offered to update the source with the Revision 255 changes when the package is done. Smile

My first ambition to write the package was so that I could do the code right for WolfDX this time. But it also helps out Dean in porting one of his mods to SDL.

I admit I've gotten a little carried away adding features lately. My plan in the past two months was to fix two SDL-related sound bugs with the guard alerts and the opening doors. Yet, I just finished debugging some HUD-based Actors. So, I've obviously gotten a little sidetracked. Smile BTW, HUD-based Actors are drawn on the screen in the same manner as the player's weapon, the "Demo" sprite, and the "Deathcam" image.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Mon May 09, 2011 7:47 am
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Tricob: Right on. I figured it was something like that. I would probably get sidetracked too though - haha. Smile

Ok, here's an easy way to increase the speed while scrolling past lots of walls:

::: CODE :::
/*
===================
=
= OverheadRefresh
=
===================
 */

int xstart, ystart, VIEWTILEX, VIEWTILEY;
int rotateActor[9] = {6,5,4,3,2,1,0,7,0}, checkx, checky;
int TileMSize, pixelSize, floorSize, TileMMapRatio, TileMWallRatio;

::: CODE :::
void SetupMapDefaults ()
{
    checkx = checky = 0;

   
    if (Keyboard[sc_2])
    {
        if (scaleFactor < 4)        TileMSize = 32;
        else                        TileMSize = 64;

::: CODE :::
            if (tile && tile < MAXWALLTILES)
            {
                // Draw Wall
                if ((checkx || checky) && tile == (unsigned)actorat[x+checkx][y+checky])
                    continue;


                if (Keyboard[sc_Tab] && MAPSPOT(x,y,1) == PUSHABLETILE)
                    TileMFloor(sx,sy,col_secret);
                else
                    TileMWall(sx,sy,(tile*2-2));
            }

::: CODE :::
        //
        // let user pan around
        //
        PollControls ();
        checkx = checky = 0;

        if (controlx < 0 && maporgx>0)
        {
   maporgx--; checkx++; }
        if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
        {
   maporgx++; checkx--; }
        if (controly < 0 && maporgy>0)
        {
   maporgy--; checky++; }
        if (controly > 0 && maporgy<mapheight-VIEWTILEY)
        {
   maporgy++; checky--; }

#if 0

How does it work? Lets say you move left, as in this example:

http://www.freewebs.com/choksta/map_before.png
http://www.freewebs.com/choksta/map_after.png

This originally took 659 wall textures to draw, but many textures you're drawing over are the same:

http://www.freewebs.com/choksta/map_check.png
http://www.freewebs.com/choksta/map_after2.png

Since the 548 cyan textures don't change, you can get the same results by only drawing the 111 different ones. Party

Oh... also, you can delete this stuff in red if you want:

::: CODE :::
void TileMDoor(unsigned sx, unsigned sy, byte doornum)
{
    int doorpage;
    #define DOORWALL (PMSpriteStart-8)

    if (doorobjlist[doornum].action == dr_open)
    {
        TileMFloor(sx,sy,col_floor);
        return;
    }


    switch(doorobjlist[doornum].lock)
    {

I just remembered, that the door already gets set to 0 on the actorat when it's open, so this code isn't needed at all.
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 23 Oct 2016

Topics: 52
Posts: 2187
Location: Australia
australia.gif

PostPosted: Mon May 09, 2011 10:52 pm
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris, THIS page will give you all the answers you need about why the gun sizes are different in the Beta version, as well as anything else you could possible ever want to know about what's different from the Beta to Alpha versions.

_________________
The Wolfenstein 3d Blog
The Wolfenstein 3d Blog is now on Facebook!

"Strong minds discuss ideas, average minds discuss events, weak minds discuss people" - Socrates
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue May 10, 2011 5:33 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT -

Dean wrote:
Chris, THIS page will give you all the answers you need about why the gun sizes are different in the Beta version, as well as anything else you could possible ever want to know about what's different from the Beta to Alpha versions.
Any way this page can be updated? I have some info regarding the Alpha's palette and the purple outlines in v1.0+.
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 23 Oct 2016

Topics: 52
Posts: 2187
Location: Australia
australia.gif

PostPosted: Wed May 11, 2011 12:11 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
OT -

Dean wrote:
Chris, THIS page will give you all the answers you need about why the gun sizes are different in the Beta version, as well as anything else you could possible ever want to know about what's different from the Beta to Alpha versions.
Any way this page can be updated? I have some info regarding the Alpha's palette and the purple outlines in v1.0+.

Not sure Tricob, It's an independant site that has done it. I'm sure if you looked around you might be able to find out who hosts it and see if they are interested.

_________________
The Wolfenstein 3d Blog
The Wolfenstein 3d Blog is now on Facebook!

"Strong minds discuss ideas, average minds discuss events, weak minds discuss people" - Socrates
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Mon Jun 06, 2011 12:47 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks for the link Dean. I enjoyed placing my cursor over the pictures and reading the random captions Laughing

One thing they didn't talk about, though... is the Tile16s...


http://choksta.webs.com/tile16s.gif

These can be viewed from WDC too. Chunks 066-167 are tiles 0-101 on the map plane, and chunks 211-423 are tiles 1-213 on the object plane (when reading from the Maptemp file). Chunk 210 seems to be a test/placeholder of some kind for 338.

This site has some Alpha comparisons too, if anyone's curious: http://wolf3dmall.zxq.net/AlphaWolf.htm
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Sun Jun 19, 2011 6:15 pm
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Cool stuff Chris.
I added this to EOD4SDL with some modifications.

For the static objects, I'd imagine most people don't add objects after the vines/spear, rather they add them at the end. Probably the best way to draw these objects would be to setup something similar to 'actorat' except have entries point to static objects. I'm doing it this way and it works well.

Now, if only we had a map editor that could draw maps like this Shocked

EDIT: Forgot to mention that this code doesn't work on Mac OS X (probably depends on what compiler you're using).
The fix: change unsigned tile; to uintptr_t tile; and tile = (unsigned)actorat[x][y]; to tile = (uintptr_t)actorat[x][y];

_________________
Steam: http://steamcommunity.com/id/stormx312
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Mon Jun 20, 2011 6:10 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hate to double post but I'd figure I'd contribute something.

Making the following changes only draws the parts of the map the player has seen at least once. This makes for a nice automap to use without cheating.

In WL_DEF.H
------------------------
add:
::: CODE :::
extern  byte            spotvis[MAPSIZE][MAPSIZE];
extern byte             spotsaw[MAPSIZE][MAPSIZE];


In WL_DRAW.C
-------------------------
Add somewhere in the declaration area:
::: CODE :::
int texdelta;
byte             spotsaw[MAPSIZE][MAPSIZE];


Add to HitHorizWall:
::: CODE :::
    int wallpic;
    int texture;
    uint16_t tile;

    *((byte *)spotsaw+yspot)=1;


Add to HitVertWall:
::: CODE :::
    int wallpic;
    int texture;
    uint16_t tile;

    *((byte *)spotsaw+xspot)=1;


Add to AsmRefresh:
::: CODE :::
passvert:
            *((byte *)spotvis+xspot)=1;
            *((byte *)spotsaw+xspot)= 1;

            xtile+=xtilestep;


Also in AsmRefresh:
::: CODE :::
passhoriz:
            *((byte *)spotvis+yspot)=1;
            *((byte *)spotsaw+yspot)=1;

            ytile+=ytilestep;



In WL_GAME.C
-------------------
Add this to SetupGameLevel:
::: CODE :::
void SetupGameLevel (void)
{
    int  x,y;
    word *map;
    word tile;

    if (!loadedgame)
    {
         memset(spotsaw,0,maparea);


In WL_MAIN.C Oops, thanks Chris ;D
-----------------
Add in SaveTheGame:
::: CODE :::
    fwrite(tilemap,sizeof(tilemap),1,file);
    checksum = DoChecksum((byte *)tilemap,sizeof(tilemap),checksum);
    fwrite (spotsaw,sizeof(spotsaw),1,file);
    checksum = DoChecksum((byte *)spotsaw,sizeof(spotsaw),checksum);



Add in LoadTheGame:
::: CODE :::
    fread (tilemap,sizeof(tilemap),1,file);
    checksum = DoChecksum((byte *)tilemap,sizeof(tilemap),checksum);

    fread (spotsaw,sizeof(spotsaw),1,file);
    checksum = DoChecksum((byte *)spotsaw,sizeof(spotsaw),checksum);


Finally in WL_DEBUG.C
-------------------
Add in OverheadRefresh:
::: CODE :::
            sx = (x-maporgx)*floorSize + xstart;
            sy = (y-maporgy)*floorSize + ystart;

            if (!spotsaw[x][y]) {
                   TileMFloor(sx,sy,0);
                   continue;
            }


            switch (viewtype)
            {


if you're using the checkx & checky addition, add this as well:

::: CODE :::
                if ((mcheckx || mchecky) && tile == (uintptr_t)actorat[x+mcheckx][y+mchecky] && spotsaw[x+mcheckx][y+mchecky] == spotsaw[x][y])
                    continue;


Hopefully I didn't forget anything important. Smile

_________________
Steam: http://steamcommunity.com/id/stormx312


Last edited by KyleRTCW on Wed Jun 22, 2011 10:31 am; edited 1 time in total
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Wed Jun 22, 2011 9:05 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks Kyle. I tried out your "spotsaw" and it works wonderfully Smile (small note: Save/LoadTheGame was in wl_main.cpp.)
I like it how you added it to HitHoriz/HitVertWall to grab the walls too! Nice idea.

By the way, did you happen to notice the bug in the original wolf3d/4SDL code... where it draws the spotvis through the doors on certain angles? I asked Ripper about this once (Wolf4GW thread), though not sure if he figured out what's going on there yet either.

KyleRTCW wrote:
Probably the best way to draw these objects would be to setup something similar to 'actorat' except have entries point to static objects. I'm doing it this way and it works well.

I agree with you! I tried this a few weeks ago, and it worked well for me also. It was cool because you didn't need the spr_start/end, as you could just point to (statobj_t *)obj->shapenum from the map to find the picture for each sprite (as you probably figured out), and could easily remove stuff (or check for shapenum = -1) when they're picked up.

KyleRTCW wrote:
Now, if only we had a map editor that could draw maps like this

Yes, I was thinking about this too. I suppose it wouldn't be that hard to expand upon the code and make a Wolf4SDL map editor in the game itself. I'm thinking if you just wanted to use the keyboard, you could have options like this maybe:

- Enter: Switch to edit mode (puts a square around the current tile)
- Arrow Keys: Move around tiles
- Shift: Show selected walls/objects
- 1: Place selected Wall on map
- 2: Place selected floor on map
- 3: Place selected door on map (automatically figures out if it's N/S or E/W)
- 4: Place selected sprite on map
- 5: Place selected actor on map
- 6: Place object 0 (nothing) on map
- Shift 1-5: Change the current selection (pulls up a list)
- Tab: peek at BasicOverhead
- F: Toggle floors (maybe have a black dot with 16-31 floors, blue with 32+, etc.)
- O: Toggle objects on/off
- D: Display amount of doors, sprites, actors
- S: Save
- G: Game mode (show the area in 3D)
- Automatically loads mapsegs[0-1] data instead of actorat data
- Automatically display a 3 and 4 on higher difficulty enemies
- more random options...

What do you think? Got any more ideas/suggestions for something like this?

KyleRTCW wrote:
EDIT: Forgot to mention that this code doesn't work on Mac OS X (probably depends on what compiler you're using).
The fix: change unsigned tile; to uintptr_t tile; and tile = (unsigned)actorat[x][y]; to tile = (uintptr_t)actorat[x][y];

Cool, I guess it's better to use those fixed *_t declarations anyway. What compiler are you using for the Mac OS X version?
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Wed Jun 22, 2011 9:39 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris wrote:
By the way, did you happen to notice the bug in the original wolf3d/Wolf4SDL code... where it draws the spotvis through the doors on certain angles? I asked Ripper about this once, though not sure if he figured out what's going on there yet either.


It's funny you mention that because I noticed that almost immediately after implementing it. I remember reading one of BT's posts not too long ago and he said something about increasing the precision of PI to help with closing the gaps in the raycaster... I tried doing this but it didn't seem to do much.

Quote:
KyleRTCW wrote:
Now, if only we had a map editor that could draw maps like this

Yes, I was thinking about this too. I suppose it wouldn't be that hard to expand upon the code and make a Wolf4SDL map editor in the game. I'm thinking if you just wanted to use the keyboard, you could have options like this maybe:

- Enter: Switch to edit mode (puts a square around the current tile)
- Arrow Keys: Move around tiles
- Shift: Show selected walls/objects
- 1: Place selected Wall on map
- 2: Place selected floor on map
- 3: Place selected door on map (automatically figures out if it's N/S or E/W)
- 4: Place selected sprite on map
- 5: Place selected actor on map
- 6: Place object 0 (nothing) on map
- Shift 1-5: Change the current selection (pulls up a list)
- Tab: peek at BasicOverhead
- F: Toggle floors (maybe have a black dot with 16-31, blue with 32+, etc.)
- O: Toggle objects on/off
- D: Display amount of doors, sprites, actors
- S: Save
- G: Game mode (show the area in 3D)
- Automatically loads mapsegs[0-1] data instead of actorat data
- Automatically display a 3 and 4 on higher difficulty enemies
- more random options...

What do you think? Is this a good idea? Got any more ideas/suggestions for this?


You know, now that I'm summer break from the uni, I've been thinking about doing a summer coding project, something fun... This would be a cool thing to do, though I'd imagine this would take MUCH longer to do as there is a lot involved. The problem I have with this is that I don't have much of an understanding of how the data files (maps/vswap) are structured. Do you where I could find some information on this so I don't have to decipher the code? If I knew the structure, I could at least get off the ground with something.
If I were to do this, I'd definitely do it in Java, as I have a better backgound in that than C++.

Quote:
KyleRTCW wrote:
EDIT: Forgot to mention that this code doesn't work on Mac OS X (probably depends on what compiler you're using).
The fix: change unsigned tile; to uintptr_t tile; and tile = (unsigned)actorat[x][y]; to tile = (uintptr_t)actorat[x][y];

Cool, thanks for the info about this. What compiler are you using for the Mac OS X version?
I'm using Xcode 3.2 with the GCC 4.2 compiler. I think the main issue is that environment variables and types can vary between operating systems which can be pretty interesting in some cases. It complained about losing precision.

_________________
Steam: http://steamcommunity.com/id/stormx312
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Jun 22, 2011 7:14 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
It's funny you mention that because I noticed that almost immediately after implementing it. I remember reading one of BT's posts not too long ago and he said something about increasing the precision of PI to help with closing the gaps in the raycaster... I tried doing this but it didn't seem to do much.

I'm still fine-tuning this; the problem shows up far less frequently with my current version, but it's not quite eliminated yet. Direct quote from WL_DEF.H:
::: CODE :::
#define PI                                       3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Wed Jun 22, 2011 7:36 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
KyleRTCW wrote:
It's funny you mention that because I noticed that almost immediately after implementing it. I remember reading one of BT's posts not too long ago and he said something about increasing the precision of PI to help with closing the gaps in the raycaster... I tried doing this but it didn't seem to do much.

I'm still fine-tuning this; the problem shows up far less frequently with my current version, but it's not quite eliminated yet. Direct quote from WL_DEF.H:
::: CODE :::
#define PI                                       3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679


Whoa, what if I told you already had the EXACT same number of places you listed there. Not even kidding, that's freaky stuff Razz
Anyway, I have a bunch of gap save games, didn't seem to affect them Sad

Chris, I drew up a quick concept picture for a map editor:
Wouldn't something like this be cool? Razz The map view would be similar to what you got going here, the list could be a tile view of vswap images. I don't believe I have the experience to undertake a project of this magnitude at this point in time though, but it was cool to draw up nonetheless Razz

_________________
Steam: http://steamcommunity.com/id/stormx312
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Thu Jun 23, 2011 7:40 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
Whoa, what if I told you already had the EXACT same number of places you listed there. Not even kidding, that's freaky stuff Razz
More than likely, you got it from the same source as I ... Wikipedia, IIRC. Smile However, the problem only seems to show up on 1280x800, not 640x480 or 320x200. Haven't tried it out on 640x400 yet.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Tue Jun 28, 2011 9:58 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
You know, now that I'm summer break from the uni, I've been thinking about doing a summer coding project, something fun... This would be a cool thing to do, though I'd imagine this would take MUCH longer to do as there is a lot involved. The problem I have with this is that I don't have much of an understanding of how the data files (maps/vswap) are structured. Do you where I could find some information on this so I don't have to decipher the code? If I knew the structure, I could at least get off the ground with something.

Hey Kyle. Cool looking editor-prototype! Smile

I found this pretty interesting to read for gamemaps compression, if you're curious...

http://www.shikadi.net/moddingwiki/RLEW_compression
http://www.shikadi.net/moddingwiki/Carmack_compression (wolf3d v1.1+ only use it)

The VSWAP file has a header at the start. If you open it in a hex editor, you'll see that it matches PM_Startup() in id_pm.cpp (First it shows the number of pages, then the first sprite/sound page number, then the locations of each page [stuff like 000 004 208 gets translated like 0*65536 + 4*256 + 208 = so it's contents would start at byte 1232], then the size of each page [4096 for all walls], then it goes into the actual wall tile data - which is just 1 byte vga colors that match the wolf3d palette, then there's the sprites which do the same but use compression, then the sounds/list). It gets pretty interesting once you dive into it. Dog

Tricob wrote:
However, the problem only seems to show up on 1280x800, not 640x480 or 320x200. Haven't tried it out on 640x400 yet.

From what I've seen, it can happen on all resolutions (it even happened to me in the original Dos version, so it's definitely an original raycastor problem), but there's almost 5 times as many "pixx" (angle rays -> vertical lines) to calculate and to draw on 1280 in full screen than on 320 with the border... so that's probably why you noticed it more often there. Car

Here's a cheap fix though, if you want to play around (just throw it above AsmRefresh() in wl_draw.cpp)...

::: CODE :::
bool RefreshCorner (bool flip)
{
    if (tilemap[xtile][ytile] && (xtile-xtilestep) == (xintercept>>TILESHIFT) && (ytile-ytilestep) == (yintercept>>TILESHIFT))
    {
        if (lastside == flip) return true;
        if (lasttilehit&(MAXWALLTILES<<1)) lastside=3;
        tilehit = lasttilehit;
    }
    return false;
}

And call it from the 2 do/while loops of AsmRefresh() like this:

::: CODE :::
            if(xspot>=maparea) break;
            tilehit=((byte *)tilemap)[xspot];
            if (RefreshCorner(false)) goto horizentry;

            if(tilehit)
            {
                if(tilehit&0x80)
                {
                    int32_t yintbuf=yintercept+(ystep>>1);
                    if((yintbuf>>16)!=(yintercept>>16) && lastside!=3)
                        goto passvert;

::: CODE :::
            if(yspot>=maparea) break;
            tilehit=((byte *)tilemap)[yspot];
            if (RefreshCorner(true)) goto vertentry;

            if(tilehit)
            {
                if(tilehit&0x80)
                {
                    int32_t xintbuf=xintercept+(xstep>>1);
                    if((xintbuf>>16)!=(xintercept>>16) && lastside!=3)
                        goto passhoriz;

As far as I can tell, it gets the job done (no see-through corners on new automap levels), though I'm sure there's a more practical way around this waiting to be discovered...

BTW Kyle - I see what you were talking about in your CalcRotate thread now. Just tried E5L1 on a 1280x720 screen, opened the first door, and the guards were pretty trippy! It got even stranger with the mutants when I started playing E2L10 and E2L2.


Last edited by Chris on Sun Sep 21, 2014 1:35 pm; edited 47 times in total
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Wed Jun 29, 2011 3:36 pm
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I eventually found that page on the gamemaps format after some more googling Smile I've already written a module to parse both the maphead and gamemaps and store the map data into nice 2D arrays that can be easily modified. So far I've written it support unlimited planes and variable map size. The one thing I hated about this was that all the data is little-endian while Java is big-endian... wasn't too much of a problem to deal with though.

Thanks for the explanation on the VSWAP format. I was able to get some of it by looking at PM_StartUp. Because the image data is stored as indices rather than RGB, I'll probably start by writing a Palette module to link indices to RGB values, or could make this a static part of a Graphics implementation. If I can get the sprites stored as Graphic objects, then I don't it would be extremely difficult to make some type of map display like the one we have here with a custom JPanel extension... My point in saying all this is that I think this project does have potential and so far it's been a pretty fun way to learn some new stuff.

_________________
Steam: http://steamcommunity.com/id/stormx312
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Jun 29, 2011 5:38 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks, Chris. I've saved the bugfix in a TXT file. I'll probably play around with it later this week. Smile
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Sun Jul 03, 2011 9:58 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I came back to this thread to take another look at the leak fix code and saw that you ninja edited it, lol. I also noticed "Last edited by Chris on Sun Jul 03, 2011 8:21 am; edited 25 times in total," if that's true, then holy crap, you really went to town with this Very Happy. I tried a little of my own debugging to try and trace this corner case of the raycaster (LOL) but when I tried to modify it, I ended up with really funky results... but the leaking was kind of fixed Wink

BTW I found a bug with my addition of (byte *)spotsaw+[x/y]spot = 1 in HitVertWall/HitHorizWall. I found that when viewing pushwalls from a certain perspective (more specifically, the transition of a face of pushwall from being visible to the player to not being visible), the game would crash. I knew I should have adequately tested this before I posted it. I'll update my post when I get the chance - I just moved the (byte *)spotsaw+[x/y]spot = 1 in HitVertWall/HitHorizWall to the lines before HitVertWall/HitHorizWall are called where AsmRefresh draws normal walls (not pushwalls). This way those lines are never executed for pushwalls where some funky stuff could happen.

_________________
Steam: http://steamcommunity.com/id/stormx312
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Sun Jul 03, 2011 7:10 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Did a little more work on my VSWAP and palette parsing modules for my map editor that is inspired by this.
My results after writing up a crude test driver: Very Happy


_________________
Steam: http://steamcommunity.com/id/stormx312
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Jul 04, 2011 10:38 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT -
KyleRTCW wrote:
I came back to this thread to take another look at the leak fix code and saw that you ninja edited it, lol. I also noticed "Last edited by Chris on Sun Jul 03, 2011 8:21 am; edited 25 times in total," if that's true, then holy crap, you really went to town with this Very Happy. I tried a little of my own debugging to try and trace this corner case of the raycaster (LOL) but when I tried to modify it, I ended up with really funky results... but the leaking was kind of fixed Wink
Do you have a link to this?
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Fri Jul 08, 2011 5:58 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hmm I've hit an interesting snag in reading in the sprites to my program...
Most of the sprites are created perfectly fine, but some, particularly the ones with very little data, have some bands of bad color data. The starting and ending positions for the bands are correct, just the color is wrong. I'm not quite sure what's going on as my method of reading in the sprites is essentially a port of the code found in TileMSprite/SimpleScaleShape. The only real difference is instead of using pointer-based data access, I'm using the RandomAccessFile component found in java.io that acts like a pointer for files.

Here's a pic: http://dl.dropbox.com/u/1884010/sprites.JPG

Is there something I'm missing in the algorithm to read in sprites with the characteristics of the ones circled?

_________________
Steam: http://steamcommunity.com/id/stormx312
Aryan_Wolf3D
I am Death Incarnate
I am Death Incarnate


Joined: 21 Jul 2011
Last Visit: 16 Dec 2017

Topics: 6
Posts: 172

blank.gif

PostPosted: Sat Feb 25, 2017 9:36 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hey Chris,

I've been playing around with this map feature, and it's pretty cool. Unfortunately, I've found that when combined with WSJ's enemy sprite offset tutorial, enemies who use sprite offsets show up as the enemy whose states they are using (i.e. using the SS officer in WSJ's example, he'll show up as a regular SS on the overhead map). I wonder if there's a way of fixing this... Looking at this bit of code in "OverheadRefresh:

::: CODE :::

// Draw Actor
objtype *obj  = (objtype *)((uintptr_t)tile);
int shapenum = ((statetype *)obj->state)->shapenum;
if (obj->state->rotate) shapenum += rotateActor[obj->dir];

TileMSprite(sx,sy,shapenum);

The sprites are being detected by the enemy's current state, correct? Is there a way of modifying it to take sprite offsets into account as well?

_________________
"Way too many #ifdefs in the code!" - John Carmack
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 17 Dec 2017

Topics: 55
Posts: 2116
Location: Canada
blank.gif

PostPosted: Sun Feb 26, 2017 1:53 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hey Aryan_Wolf3d,

Thanks. I imagine you can just rip the code out of WSJ's wl_draw.cpp like this? Very Happy

::: CODE :::
// Draw Actor
objtype *obj  = (objtype *)((uintptr_t)tile);
int shapenum = ((statetype *)obj->state)->shapenum;
if (obj->state->rotate) shapenum += rotateActor[obj->dir];

switch (obj->obclass)   
{
   case ssofficerobj:
      shapenum += 298;
      break;
}


TileMSprite(sx,sy,shapenum);

Glad you like the Tab-O idea too. Just out of curiosity, what screen resolution are you guys running Wolf4SDL at these days?
Aryan_Wolf3D
I am Death Incarnate
I am Death Incarnate


Joined: 21 Jul 2011
Last Visit: 16 Dec 2017

Topics: 6
Posts: 172

blank.gif

PostPosted: Sun Feb 26, 2017 6:21 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sadly, that doesn't seem to work... It's still showing a regular SS in his place.

Quote:
Glad you like the Tab-O idea too. Just out of curiosity, what screen resolution are you guys running Wolf4SDL at these days?

I tend to run it at the default resolution, since most mods don't have the fix for showing guard angles properly at higher resolutions. Otherwise, I'd run it at 1280x800, since that's the only setting that fills my screen properly.

On a side note, I also wonder if there's a better way of making the map pan around more slowly than the method I used...

::: CODE :::

if (controlx < 0 && maporgx>0)
    maporgx--; VW_WaitVBL (1);
if (controlx > 0 && maporgx<MAPWIDTH-VIEWTILEX)
    maporgx++; VW_WaitVBL (1);
if (controly < 0 && maporgy>0)
    maporgy--; VW_WaitVBL (1);
if (controly > 0 && maporgy<MAPHEIGHT-VIEWTILEY)
    maporgy++; VW_WaitVBL (1);

It works, but it's kind of stupid, and of course when both x & y are used, two numbers are added together, slowing it down even more.

_________________
"Way too many #ifdefs in the code!" - John Carmack
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:37 ago.

Topics: 160
Posts: 8011
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Feb 26, 2017 7:05 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sounds like you need a flag set to "false" when it's about to scan the keys, set it to "true" whenever it moves the map, and have it play that VBL when the flag is marked as "true".
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 2:03 ago.

Topics: 37
Posts: 2401
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Sun Feb 26, 2017 11:42 am
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Using VBLs is OK, but it's a little messy. If you want to delay it you need another variable that counts how long a button has been held down for and every time it gets over a certain value, you move in the relevant direction and reset it to 0.
Aryan_Wolf3D
I am Death Incarnate
I am Death Incarnate


Joined: 21 Jul 2011
Last Visit: 16 Dec 2017

Topics: 6
Posts: 172

blank.gif

PostPosted: Sun Feb 26, 2017 12:23 pm
   Subject: Re: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@AlumiuN

Thanks, that sounds like the best way. I'll see if I can get it to work.

_________________
"Way too many #ifdefs in the code!" - John Carmack
Wolf3DGuy
Can I Play Daddy
Can I Play Daddy


Joined: 01 Aug 2017
Last Visit: 3:10 ago.

Topics: 3
Posts: 48
Location: Hungary
hungary.gif

PostPosted: Fri Sep 01, 2017 1:44 pm
   Subject: Enabling Tab-O (using VSWAP images as Tile16Ms)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Thanks the code Chris. It's works nice in my wl9 mod.
The only thing I miss in here is the players spot on the map

Here's the code:
In wl_debug.cpp at the OverHeadRefresh under the Draw Actor, add this few lines
::: CODE :::

                if (player->tilex == x && player->tiley == y)
                {
                    TileMSprite(sx,sy,(SPR_BJ_W1));
                }


It will show a standing BJ at the same spot where the player actually stands, it has a bug when the player reach the EndGame trigger, it will show two BJs. One is standing on the EndGame trigger and the other will run/jump. There's two ways to fix this bug, the second is better I think.

The first Code is to edit the code above:
::: CODE :::

                if (player->tilex == x && player->tiley == y)
                {
                    if (gamestate.victoryflag == true)
                    {
                        TileMFloor(sx,sy,col_floor);
                    }
                    else
                    {
                        TileMSprite(sx,sy,(SPR_BJ_W1));
                    }
                }


It has a bug too when you kill a boss which has Death cam (Schabbs, Hitler, Otto, Fettgesicht). The bug is when is the death cam shown up, the map will not show the player.

The second code (I recommend) is to turn off the map when the victoryflag is true.

In wl_play, edit the ViewMap(); thing

::: CODE :::

    if (Keyboard[sc_Tab])
    {
        if (gamestate.victoryflag == true)
        {
            //ViewMap();
        }
        else
        {
            ViewMap() ;
        }
    }


With this code you can't open the map when you reach the EndGame trigger, or when you see the Death cam.
Hope it's works wonderfully, report if you found a 'new' bug. Wink
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 Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 17504 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 7362 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2197 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 2403 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 3276 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