"READ THIS!" IN WOLF4SDL

In this tutorial I'll explain you how to enable the "Read This!" feature in Wolf4SDL for the Spear of Destiny and Wolfenstein 3D code base.

Code Legend:
Blue lines - Code changes
Red lines - Code additions

For Wolfenstein 3D code base users

Enabling this feature in Wolf4SDL for the Wolfenstein 3D code base is really a piece of cake, and I'm not going to fully explain you here how to enable it in Wolfenstein 3D, because the required code changes are almost exactly the same for the DOS and Wolf4SDL version, so you can just follow this tutorial by MCS and you're all set, when you're using the Apogee version. Should you be using any other Wolfenstein 3D version (e.g. from GT Interactive), you need to make some small code changes in your wl_def.h:

Click to show code

[...]

#include "foreign.h"

#ifndef SPEAR
    #include "audiowl6.h"
    #ifdef UPLOAD
        #include "gfxv_apo.h"
    #else
        //#ifdef GOODTIMES
            #include "gfxv_wl6.h"
        //#else
        //    #include "gfxv_apo.h"
        //#endif
    #endif
#else
    #include "audiosod.h"
    #include "gfxv_sod.h"
    #include "f_spear.h"
#endif

[...]

And that's it. Now you've enabled the "Read this!" feature in Wolfenstein 3D!

For Spear of Destiny code base users

First of all, open your version.h, and (un)comment those code lines:

Click to show code

[...]

/* Defines used for different versions */

#define SPEAR
//#define SPEARDEMO
//#define UPLOAD
#define GOODTIMES
#define CARMACIZED
//#define APOGEE_1_0
//#define APOGEE_1_1
//#define APOGEE_1_2

[...]

//#define ARTSEXTERN

[...]

Our next step is to make code changes in the wl_menu.h:

Click to show code

[...]

//#ifndef SPEAR
//#ifndef GOODTIMES
#define MENU_H  13*8+6
//#else
//#define MENU_H  13*9+6
//#endif
//#else
//#define MENU_H  13*9+6
//#endif

[...]

enum menuitems
{
        newgame,
        options,
        loadgame,
        savegame,

//#ifndef GOODTIMES
//#ifndef SPEAR
        readthis,
//#endif
//#endif

        viewscores,
        backtodemo,
        quit
};

[...]

Now open the wl_menu.cpp and change the follwing code lines:

Click to show code

[...]

//#ifndef GOODTIMES
//#ifndef SPEAR

#ifdef SPANISH
    {2, "Ve esto!", CP_ReadThis},
#else
    {2, "Read This!", CP_ReadThis},
#endif

//#endif
//#endif

[...]

    //
    // F-KEYS FROM WITHIN GAME
    //
    switch (scancode)
    {
        case sc_F1:
/*#ifdef SPEAR
            BossKey ();
#else
#ifdef GOODTIMES
            BossKey ();
#else*/
            HelpScreens ();
//#endif
//#endif

[...]

//#ifndef GOODTIMES
//#ifndef SPEAR
////////////////////////////////////////////////////////////////////
//
// READ THIS!
//
////////////////////////////////////////////////////////////////////
int
CP_ReadThis (int)
{
    StartCPMusic (XPUTIT_MUS);
    HelpScreens ();
    StartCPMusic (MENUSONG);
    return true;
}
//#endif
//#endif

[...]

    //
    // CHANGE "READ THIS!" TO NORMAL COLOR
    //
//#ifndef SPEAR
//#ifndef GOODTIMES
    MainMenu[readthis].active = 1;
//#endif
//#endif

[...]

            //
            // CHANGE "READ THIS!" TO NORMAL COLOR
            //
//#ifndef SPEAR
//#ifndef GOODTIMES
            MainMenu[readthis].active = 1;
//#endif
//#endif

[...]

//#ifndef SPEAR
//#ifndef GOODTIMES
    strcat (helpfilename, extension);
//#endif
    strcat (endfilename, extension);
//#endif
#endif
}

Our last code changes are to made in the wl_text.cpp:

Click to show code

[...]

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

                                                 LOCAL CONSTANTS

=============================================================================
*/
//#ifndef SPEAR

[...]

    //
    // clear the screen
    //
    VWB_Bar (0,0,320,200,BACKCOLOR);
    VWB_DrawPic (0,0,IDGUYS1PIC);
    VWB_DrawPic (0,8,IDGUYS2PIC);
    VWB_DrawPic (312,8,COPYPROTTOPPIC);
    VWB_DrawPic (8,176,COPYPROTBOXPIC);
	
[...]

//#ifndef SPEAR
                CA_CacheGrChunk(IDGUYS1PIC);
                CA_CacheGrChunk(IDGUYS2PIC);
                CA_CacheGrChunk(COPYPROTTOPPIC);
                CA_CacheGrChunk(COPYPROTBOXPIC);
//#endif

[...]

/*
=================
=
= HelpScreens
=
=================
*/
//#ifndef SPEAR
void HelpScreens (void)
{
    [...]
}
//#endif

[...]

    VW_FadeOut();
    SETFONTCOLOR(0,15);
    IN_ClearKeysDown();
    if (MousePresent && IN_IsInputGrabbed())
        IN_CenterMouse();  // Clear accumulated mouse movement

    FreeMusic ();
#endif
}
//#endif

The used macro definitions in the VWB_DrawPic() and CA_CacheGrChunk() functions are just examples and can, of course, be replaced by our own ones.

Now you just need to include a helpart.sod file (download sample helpart file) to your mod folder and add or replace the VGA images (sample VGA images can be found here), which you defined in the source code, in the vgagraph.sod file.

Congratulations, you've successfully added the "Read This!" feature to your Spear of Destiny mod :-)

Don't use any of the code from this tutorial in your mod without giving me credit!

- Havoc