Bugs and fixes
 Watcom compile
 Visual C++ comp.

 

Source code version 161W5T1 is available at: Download

If you want to get your hands on the latest version of the code, the BEST please to go is here: http://eech.bollocks.net.nz/. There is a CVS server with the latest and greatest! Subscribe (its free) and follow the instructions that can be found on this site.

You can aslo subscribe (free) to a developers mailing list.

A note on version names: naming conventions are: versions with a "W" in it are test versions compiled with Watcom Open Source. versions with "X" in them are stable releases to the community.

Source code

Bugs and fixes

The bugs and fixes described here date from before the developers mailing list was installed. Since then, many more bugs have been fixed (and created!).

Farp bug

Thanks to moje for helping out in the testing and to DeStRo of course for the WUT program that pointed me in the right direction.

Brief description of the farp bug

Choppers do not land completely but hop up and down on the landing pad. They are not cleared so that others have to wait resulting in long lines of flying choppers that get no pad assigned. One of the worse examples is Taiwan skirmish 5 for red.

Note: this fix does not solve the "helicopters being stuck at a powerline" thing, only the waiting lines at airports and farps that are generated because choppers do not end their mission.

How to fix it

I have tried all kinds of things: lowering and raising the terrain elevation of the airport and farps, tweaking the aircraft size with the "centre_of_gravity_to_ground_distance" and finally settled for two changes:

  1. To eliminate the farp bug (based on changing the value of 5 to 3 for the Waypoint->landed value in WUT), in the "landed" section in the file
    \APHAVOC\SOURCE\ENTITY\SPECIAL\GUIDE\GD_DBASE.C
    (Lines 196 and 195):
    replace
    { TRUE, 0.005 }, // GUIDE_CRITERIA_ALTITUDE
    with
    { TRUE, 0.5 }, // GUIDE_CRITERIA_ALTITUDE
    (other values like 0.1, 0.2 seem to make little difference),
    and also
    { TRUE, rad (1) }, // GUIDE_CRITERIA_HEADING
    to
    { TRUE, rad (30.0) }, // GUIDE_CRITERIA_HEADING
    this makes the choppers shift direction sometimes after they have landed, which seems to speed up their changing status.
  2. To eliminate the bunny hopping raise the landing waypoint elevation in:
    \APHAVOC\SOURCE\AI\FACTION\POPREAD.C
    (Line 2985):
    after
    waypoint_world_pos.y += height_offset;
    insert:
    waypoint_world_pos.y = max(waypoint_world_pos.y,get_3d_terrain_point_data
            (waypoint_world_pos.x,waypoint_world_pos.z, NULL ));
    waypoint_world_pos.y += 0.1;

    so I ensure the waypoint is at terrain elevation and add 10 cm to account for local differences in elevation. Smaller values (0.01, 0.05) give some hopping, depends on the actual real world data I guess.

That's all. In fact I still can't find where the helicopter is actually stopped! It's a complicated system of messages passed to entities of which there are about 1 zillion.

Note: after a brief time the rotors spin down, but this may take a bit longer especially with large transport choppers.

Note: the behaviour is slightly different from version 1,5,1D but the code may not be exactly the same in the first place as 1.5.1D is based on an older compiled 1.4.6x version. The result however is pretty similar.

Double mouse problem

Description

Sometimes a double mouse is visible (when the resilution in EECH is different from the desktop). This due to a bug in the mouse initialisation files.

Fix

- in modules/system/mouse.c (by "Andrew" in the developers forum)

To get rid of the second (windows) cursor when returning to EECH set mouse co-operative to NONEXCLUSIVE in initialise_mouse function :

ret = IDirectInputDevice7_SetCooperativeLevel ( direct_input_mouse, application_window, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE );

NOTE: there are two instances of this line (thanks Moje)!

To solve the problem with lack of mouse click in 2D until a keyboard key is pressed, clear the ALT modifier. Add the following in beginning of process_mouse_event function :

if ((current_modifier_states & (1 << MODIFIER_LEFT_ALT)) ||
(current_modifier_states & (1 << MODIFIER_RIGHT_ALT)))
{
current_modifier_states = MODIFIER_NONE;
}

Campaign load bug

Description

A bug makes it impossible to load saved campaigns with builds made with VC/gcc or anything that is not watcom.

Fix

Faulty function is unpack_bit and pack_bit in the file APHAVOC\SOURCE\ENTITY\SYSTEM\EN_FUNCS\EN_PACK.C
The following code fixes this bug and for vc adds a much faster version (similar to watcom). Three steps:

step 1) unpack_bit: Simply replace ifdef/endif braced lines with this:

Code: #ifdef __WATCOMC__

void unpack_bit (int *unpacked_data, unsigned char *unpack_ptr);

#pragma aux unpack_bit = \
"shl byte ptr [edx],1" \
"rcr dword ptr [eax],1" \
parm [eax] [edx] \
modify exact [];

#else

// VC Intel version
#if defined(_MSC_VER) && defined(_M_IX86)

static __inline void unpack_bit (int *unpacked_data, unsigned char *unpack_ptr)
{
__asm
{
mov eax, [unpack_ptr]
shl byte ptr [eax],1
mov eax, [unpacked_data]
rcr dword ptr [eax],1
}
}

#else

// generic C version
void unpack_bit (int *unpacked_data, unsigned char *unpack_ptr)
{
unsigned int // changed from RW's signed
unpacked_value,
temp;

unsigned char
packed_value;

packed_value = *unpack_ptr;

temp = packed_value;

temp <<= 24; // changed from RW's 23

temp &= 0x80000000;

unpacked_value = *unpacked_data;

unpacked_value >>= 1;

unpacked_value |= temp;

packed_value <<= 1;

*unpacked_data = unpacked_value;

*unpack_ptr = packed_value;
}
#endif

#endif

step 2) pack_bit: Simply replace ifdef/endif braced lines with this:

#ifdef __WATCOMC__

void pack_bit (int *unpacked_data, unsigned char *pack_ptr);

#pragma aux pack_bit = \
"shr dword ptr [eax],1" \
"rcl byte ptr [edx],1" \
parm [eax] [edx] \
modify exact [];

#else

// VC Intel version
#if defined(_MSC_VER) && defined(_M_IX86)

static __inline void pack_bit (int *unpacked_data, unsigned char *pack_ptr)
{
__asm
{
mov eax, unpacked_data
shr dword ptr[eax],1
mov eax, pack_ptr
rcl byte ptr[eax],1
}
}

#else

// generic C version

void pack_bit (int *unpacked_data, unsigned char *pack_ptr)
{
int
unpacked_value;

unsigned char
packed_value;

packed_value = *pack_ptr;

packed_value <<= 1;

unpacked_value = *unpacked_data;

packed_value |= (unpacked_value & 1);

unpacked_value >>= 1;

*unpacked_data = unpacked_value;

*pack_ptr = packed_value;
}
#endif

#endif

step 3) At this point saved games loads but alas, we have an exception soon. To prevent it we need to swap lines in APHAVOC\SOURCE\ENTITY\SYSTEM\EN_COMMS\EN_SESSN.C
in original source from RW swap lines 1394 with 1396 so they look like this:

entity_smoke_list_creation = entity_smoke_list_creation->next;

free_mem (this_smoke_list_creation);

and lines 1442 with 1444 to look like this:

entity_sound_effect_creation = entity_sound_effect_creation->next;

free_mem (this_sound_effect_creation);

Compiling with Open Watcom

Here is how to compile the source code with the free Open Watcom compiler.

  1. Get the source code from razorworks (6.5 MB): here
    (install it in a "simple" directory name, Watcom doesn't like names with spaces)
  2. Get the free Open Watcom compiler (63.3 MB) here
  3. Get DirextX 9 SDK from Microsoft (227.7 MB): here

The code can be compiled using the following adaptions (thanks to everybody at the Biohazcentral EECH developers forum!):

- makefile:

- make a directory linklib under /modules and copy all the libs in DXSDK\lib to that new dir

- then copy the watcom version of dsound.lib (from watcom\lib386\nt\) to the \modules\linklib and overwrite the version from dx9

- copy all the h-files in DXSDK/include to /watcom/h/nt

- in watcom/h float.h: decrease FLT_MAX: #define FLT_MAX 3.402823e+38f (line 86)

- in watcom/h/nt in strmif.h comment out all code between the #ifndef and #endif (line 6182):

/*
#ifndef _WINGDI_

[...]

#endif
*/

If you do not use the CVS version of the code:

- in modules\system.h: add
#define DIRECTINPUT_VERSION 0x0700
#include "vwf.h" changed to #include <vfwmsgs.h> (line 381)

- in aphavoc\source\entity\special\group\gp_ptr.c (line 170)
void overload_group_ptr_value_functions (entity_types type)
changed to
void overload_group_ptr_value_functions (void)

- in aphavoc\source\entity\special\guide\gd_ptr.c (line 197) change to void:

void overload_guide_ptr_value_functions (void) //(entity_types type)

- in dirsound.c add:

#include "d3d.h"

- in vslider.h (modules\userint\ui_obj\slider and ..\userint2\.. changed:

extern void vslider_move_function (void *ev);

to:

extern void vslider_move_function (event *ev);

Compiliing with version 1.2 of Watcom

From Craigmire in the SimHQ forum:

If you want to use Watcom version 1.2 here's how I got it to work for me:

I dug out of the forum at the watcom site that some of the automatically included libraries that were defaults in earlier versions had been left out of version 1.2. You get about 20 undefined references that are defined in winmm.lib or ws2_32.lib. There is a settings file in watcom where these can be added back in but I took the simpler approach. I changed the link section of the ...\aphavoc\makefile file to look like this:


########################################
#
# HOW TO MAKE TARGET
#
########################################

!ifdef visualc

$(projectname).exe : $(c_object_files) $(c_module_object_files) $(projectname).lnk
link @$(projectname).lnk

!else

$(projectname).exe : $(c_object_files) $(c_module_object_files) $(projectname).lnk
wlink library winmm library ws2_32 @$(projectname).lnk

!endif

in other owrds add the "wlink library winmm library" to the last line

 

That should do it. Good luck!

Compiling with Visual C++ 6.0

*** This info is probably outdated ***

Here are the workspace files for VC6, thanks to "Xhit"

The directories for include and lib files have to be set to point to the apropiate directx library and include, and also have to point to the /modules and /aphavoc/source dirs.

Changes

The following lines have to be added to system.h

#define DIRECTINPUT_VERSION 0x0700

#define ENV_NAME """COMANCHE_HOKUM"""

#define MAJOR_VERSION 1

#define DATA_VERSION 4

#define MINOR_VERSION 7

#define BUILD_TYPE """X"""

#define APP_NAME """Enemy Engaged RAH66 Comanche Vs KA52 Hokum v1.4.7X"""

You may have to include some of the changes mentioned above in the watcom compilation

Download

VC6 release workspace files: here

VC6 debug workspace files: here