mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
936921ffc3 | ||
|
|
910b4f4319 | ||
|
|
27db22b96f |
@@ -169,6 +169,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
language: ${{ matrix.language }}
|
language: ${{ matrix.language }}
|
||||||
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
|
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
|
||||||
|
# TODO check if English and German build faster for code changes on master, if not remove caching
|
||||||
|
build-cache-enabled: ${{ matrix.language == 'English' || matrix.language == 'German' }}
|
||||||
# at least English and some other lang have to work
|
# at least English and some other lang have to work
|
||||||
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
|
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
|
build-cache-enabled:
|
||||||
|
description: 'enable sscache'
|
||||||
|
required: true
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
continue-on-error:
|
continue-on-error:
|
||||||
description: 'allows a language to fail, used when building all languages'
|
description: 'allows a language to fail, used when building all languages'
|
||||||
required: false
|
required: false
|
||||||
@@ -27,6 +32,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
|
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
|
||||||
|
env:
|
||||||
|
SCCACHE_GHA_ENABLED: ${{ inputs.build-cache-enabled }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout source
|
||||||
@@ -75,9 +82,19 @@ jobs:
|
|||||||
- uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
with:
|
with:
|
||||||
arch: x86
|
arch: x86
|
||||||
|
- name: Prepare build cache
|
||||||
|
if: ${{ inputs.build-cache-enabled }}
|
||||||
|
uses: hendrikmuhs/ccache-action@v1
|
||||||
|
with:
|
||||||
|
key: ${{ inputs.language }}_${{ matrix.application }}
|
||||||
|
save: ${{ github.ref == 'refs/heads/master' }}
|
||||||
|
variant: sccache
|
||||||
- name: Prepare build
|
- name: Prepare build
|
||||||
run: |
|
run: >
|
||||||
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
|
cmake -S . -B build -GNinja
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake --build build/ -- -v
|
cmake --build build/ -- -v
|
||||||
|
|||||||
+2
-10
@@ -992,17 +992,9 @@ void LoadGameExternalOptions()
|
|||||||
//Madd: set number of pItem files to be used
|
//Madd: set number of pItem files to be used
|
||||||
gGameExternalOptions.ubNumPItems = iniReader.ReadInteger("Data File Settings","NUM_P_ITEMS", 3, 3, MAX_PITEMS);
|
gGameExternalOptions.ubNumPItems = iniReader.ReadInteger("Data File Settings","NUM_P_ITEMS", 3, 3, MAX_PITEMS);
|
||||||
|
|
||||||
//################# Backgrounds #################
|
|
||||||
|
|
||||||
// Flugente: backgrounds
|
// Flugente: backgrounds
|
||||||
gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Backgrounds", "ENABLE_BACKGROUNDS", TRUE );
|
gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Data File Settings", "BACKGROUNDS", TRUE );
|
||||||
|
|
||||||
// Kitty: show additional IMP backgrounds and determine which IMP backgrounds are available at selection based on choices for skills, chararcter traits and disabilities
|
|
||||||
gGameExternalOptions.fAltIMPCreation = iniReader.ReadBoolean("Backgrounds", "ALTERNATIVE_IMP_CREATION", FALSE);
|
|
||||||
|
|
||||||
// Kitty: only show additional IMP backgrounds enabled by AlternativeImpCreation (same rules which are shown as with AlternativeImpCreation)
|
|
||||||
gGameExternalOptions.fReducedIMPCreation = iniReader.ReadBoolean("Backgrounds", "REDUCED_IMP_CREATION", FALSE);
|
|
||||||
|
|
||||||
//################# Merc Recruitment Settings #################
|
//################# Merc Recruitment Settings #################
|
||||||
|
|
||||||
// silversurfer: read early recruitment options 1=immediately (control Omerta), 2=early (control 1, 2, 3 towns including Omerta)
|
// silversurfer: read early recruitment options 1=immediately (control Omerta), 2=early (control 1, 2, 3 towns including Omerta)
|
||||||
|
|||||||
@@ -337,7 +337,6 @@ BOOLEAN UsingBackGroundSystem();
|
|||||||
BOOLEAN UsingImprovedInterruptSystem();
|
BOOLEAN UsingImprovedInterruptSystem();
|
||||||
BOOLEAN UsingInventoryCostsAPSystem();
|
BOOLEAN UsingInventoryCostsAPSystem();
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN IsNIVModeValid(bool checkRes = true);
|
BOOLEAN IsNIVModeValid(bool checkRes = true);
|
||||||
|
|
||||||
// Snap: Options read from an INI file in the default of custom Data directory
|
// Snap: Options read from an INI file in the default of custom Data directory
|
||||||
@@ -1559,12 +1558,6 @@ typedef struct
|
|||||||
|
|
||||||
// Flugente: backgrounds
|
// Flugente: backgrounds
|
||||||
BOOLEAN fBackGround;
|
BOOLEAN fBackGround;
|
||||||
|
|
||||||
// Kitty: Alternative IMP Creation (choices in skills/char-traits/disabilities determine available backgrounds, plus additional available backgrounds)
|
|
||||||
BOOLEAN fAltIMPCreation;
|
|
||||||
|
|
||||||
// Kitty: Reduced IMP Backgrounds (same as fAltIMPCreation, but for this only the additional backgrounds)
|
|
||||||
BOOLEAN fReducedIMPCreation;
|
|
||||||
|
|
||||||
// Sandro: Alternative weapon holding (rifles fired from hip / pistols fired one-handed)
|
// Sandro: Alternative weapon holding (rifles fired from hip / pistols fired one-handed)
|
||||||
UINT8 ubAllowAlternativeWeaponHolding;
|
UINT8 ubAllowAlternativeWeaponHolding;
|
||||||
|
|||||||
@@ -1442,6 +1442,7 @@ UINT32 InitializeJA2(void)
|
|||||||
HandleLaserLockResult( PrepareLaserLockSystem() );
|
HandleLaserLockResult( PrepareLaserLockSystem() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HandleJA2CDCheck( );
|
||||||
|
|
||||||
gfWorldLoaded = FALSE;
|
gfWorldLoaded = FALSE;
|
||||||
|
|
||||||
@@ -1471,6 +1472,9 @@ UINT32 InitializeJA2(void)
|
|||||||
//gsRenderCenterX = 805;
|
//gsRenderCenterX = 805;
|
||||||
//gsRenderCenterY = 805;
|
//gsRenderCenterY = 805;
|
||||||
|
|
||||||
|
// Init data
|
||||||
|
InitializeSystemVideoObjects( );
|
||||||
|
|
||||||
// Init animation system
|
// Init animation system
|
||||||
if ( !InitAnimationSystem( ) )
|
if ( !InitAnimationSystem( ) )
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-4
@@ -5633,15 +5633,28 @@ void EnableWeaponKitSelectionButtons()
|
|||||||
{
|
{
|
||||||
if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable )
|
if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable )
|
||||||
{
|
{
|
||||||
|
bool bShow;
|
||||||
|
INT16 usItem;
|
||||||
for(int i=0; i<NUM_MERCSTARTINGGEAR_KITS; ++i)
|
for(int i=0; i<NUM_MERCSTARTINGGEAR_KITS; ++i)
|
||||||
{
|
{
|
||||||
|
bShow = false;
|
||||||
for(int j=INV_START_POS; j<NUM_INV_SLOTS; ++j)
|
for(int j=INV_START_POS; j<NUM_INV_SLOTS; ++j)
|
||||||
{
|
{
|
||||||
if(gMercProfileGear[gbCurrentSoldier][i].inv[j] != NONE)
|
usItem = gMercProfileGear[gbCurrentSoldier][i].inv[j];
|
||||||
|
if(usItem != NONE)
|
||||||
{
|
{
|
||||||
ShowButton( giWeaponboxSelectionButton[i] );
|
bShow = true;
|
||||||
break;
|
//shadooow: if any of the item in kit is limited to specific system and this system isn't enabled then disable the whole kit from selection
|
||||||
}
|
if (((Item[usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
|
||||||
|
{
|
||||||
|
bShow = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bShow)
|
||||||
|
{
|
||||||
|
ShowButton(giWeaponboxSelectionButton[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-226
@@ -17,7 +17,6 @@
|
|||||||
#include "IMP Compile Character.h"
|
#include "IMP Compile Character.h"
|
||||||
#include "IMP Disability Trait.h"
|
#include "IMP Disability Trait.h"
|
||||||
#include "IMP Character Trait.h"
|
#include "IMP Character Trait.h"
|
||||||
#include "IMP Minor Trait.h"
|
|
||||||
#include "GameSettings.h"
|
#include "GameSettings.h"
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
|
|
||||||
@@ -603,187 +602,81 @@ void ResetDisplaySkills()
|
|||||||
|
|
||||||
extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ];
|
extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ];
|
||||||
|
|
||||||
extern BOOLEAN gfSkillTraitQuestions[20];
|
BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
|
||||||
extern BOOLEAN gfSkillTraitQuestions2[20];
|
|
||||||
|
|
||||||
extern BOOLEAN gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS];
|
|
||||||
|
|
||||||
BOOLEAN IsBackGroundAllowed(UINT16 ubNumber)
|
|
||||||
{
|
{
|
||||||
if (!ubNumber)
|
if ( !ubNumber )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// some backgrounds are only allowed to specific genders. Set both to forbid a background from ever showing up in IMP creation (for merc-specific backgrounds)
|
// some backgrounds are only allowed to specific genders. Set both to forbid a background from ever showing up in IMP creation (for merc-specific backgrounds)
|
||||||
if (fCharacterIsMale && zBackground[ubNumber].uiFlags & BACKGROUND_NO_MALE)
|
if ( fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_MALE )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (!fCharacterIsMale && zBackground[ubNumber].uiFlags & BACKGROUND_NO_FEMALE)
|
else if ( !fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_FEMALE )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// added new ini-options and accompanying background-tag
|
if ( SkillsList[0] == HEAVY_WEAPONS_NT || SkillsList[1] == HEAVY_WEAPONS_NT || SkillsList[2] == HEAVY_WEAPONS_NT )
|
||||||
// choices in skills/character-traits/disabilities determine available backgrounds if true in ja2options.ini
|
|
||||||
// new tag <alt_impcreation> has been added to backgrounds.xml
|
|
||||||
|
|
||||||
if (!gGameExternalOptions.fAltIMPCreation)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION) // don't show BG with tag <alt_impcreation> if Alt_Imp_Creation isn't true in ja2options.ini
|
if ( zBackground[ ubNumber ].value[BG_ARTILLERY] > 0 )
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// show BG with tag <alt_impcreation>,
|
|
||||||
// but don't show BG whose tags would contradict with a main bonus/penalty gained by skill/char-trait/disability
|
|
||||||
|
|
||||||
if (gGameExternalOptions.fAltIMPCreation)
|
|
||||||
|
|
||||||
// define which tags are considered contradicting for major traits, minor traits, disablities and character traits
|
|
||||||
|
|
||||||
// major traits (single-trait and dual-trait)
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //dual trait (expert)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_ARTILLERY] > 10) //single trait
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 || zBackground[ubNumber].value[BG_MARKSMANSHIP] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_MECHANICAL] < 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_MECHANICAL] < 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0 || zBackground[ubNumber].value[BG_MEDICAL] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER])
|
|
||||||
{
|
|
||||||
|
|
||||||
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0 || zBackground[ubNumber].value[BG_RESI_FEAR] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minor Traits (single trait only)
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_MELEE])
|
|
||||||
{
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_CTH_BLADE] < 0 || zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0 )
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_STEALTHY])
|
if ( SkillsList[0] == SNIPER_NT || SkillsList[1] == SNIPER_NT || SkillsList[2] == SNIPER_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_PERC_STEALTH] < 0)
|
if ( zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] < 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_DEMOLITIONS])
|
if ( SkillsList[0] == SURVIVAL_NT || SkillsList[1] == SURVIVAL_NT || SkillsList[2] == SURVIVAL_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_BONUS_BREACHINGCHARGE] < 0 || zBackground[ubNumber].value[BG_EXPLOSIVE_ASSIGN] < 0 )
|
if ( zBackground[ ubNumber ].value[BG_PERC_CAMO] < 0 )
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( SkillsList[0] == MARTIAL_ARTS_NT || SkillsList[1] == MARTIAL_ARTS_NT || SkillsList[2] == MARTIAL_ARTS_NT )
|
||||||
|
{
|
||||||
|
if ( zBackground[ ubNumber ].value[BG_PERC_DAMAGE_MELEE] < 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_SURVIVAL])
|
if ( SkillsList[0] == TECHNICIAN_NT || SkillsList[1] == TECHNICIAN_NT || SkillsList[2] == TECHNICIAN_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_TRAVEL_FOOT] < 0 || zBackground[ubNumber].value[BG_TRAVEL_CAR] <0 || zBackground[ubNumber].value[BG_TRAVEL_AIR] <0 ||
|
if ( zBackground[ ubNumber ].value[BG_MECHANICAL] < 0 )
|
||||||
zBackground[ubNumber].value[BG_RESI_DISEASE] < 0 || zBackground[ubNumber].value[BG_SNAKEDEFENSE] < 0 )
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_BODYBUILDING])
|
if ( SkillsList[0] == DOCTOR_NT || SkillsList[1] == DOCTOR_NT || SkillsList[2] == DOCTOR_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_PERC_CARRYSTRENGTH] < 0)
|
if ( zBackground[ ubNumber ].value[BG_MEDICAL] < 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_AMBIDEXTROUS])
|
if ( SkillsList[0] == MELEE_NT || SkillsList[1] == MELEE_NT || SkillsList[2] == MELEE_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_INVENTORY] > 0)
|
if ( zBackground[ ubNumber ].value[BG_PERC_CTH_BLADE] < 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NIGHT_OPS])
|
if ( SkillsList[0] == STEALTHY_NT || SkillsList[1] == STEALTHY_NT || SkillsList[2] == STEALTHY_NT )
|
||||||
{
|
{
|
||||||
if (zBackground[ubNumber].value[BG_PERC_SLEEP] > 0 || zBackground[ubNumber].value[BG_PERC_HEARING_NIGHT] < 0 )
|
if ( zBackground[ ubNumber ].value[BG_PERC_STEALTH] < 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabiliies
|
if ( SkillsList[0] == ATHLETICS_NT || SkillsList[1] == ATHLETICS_NT || SkillsList[2] == ATHLETICS_NT )
|
||||||
switch (iChosenDisabilityTrait())
|
{
|
||||||
|
if ( zBackground[ ubNumber ].value[BG_PERC_SPEED_RUNNING] < 0 )
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( SkillsList[0] == DEMOLITIONS_NT || SkillsList[1] == DEMOLITIONS_NT || SkillsList[2] == DEMOLITIONS_NT )
|
||||||
|
{
|
||||||
|
if ( zBackground[ ubNumber ].value[BG_EXPLOSIVE_ASSIGN] < 0 )
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( iChosenDisabilityTrait() )
|
||||||
{
|
{
|
||||||
case HEAT_INTOLERANT:
|
case HEAT_INTOLERANT:
|
||||||
if (zBackground[ubNumber].value[BG_DESERT] > 0 || zBackground[ubNumber].value[BG_TROPICAL] > 0)
|
if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case NERVOUS:
|
case NERVOUS:
|
||||||
@@ -793,7 +686,7 @@ BOOLEAN IsBackGroundAllowed(UINT16 ubNumber)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case NONSWIMMER:
|
case NONSWIMMER:
|
||||||
if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 )
|
if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 || zBackground[ ubNumber ].value[BG_SWIMMING] > 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case FEAR_OF_INSECTS:
|
case FEAR_OF_INSECTS:
|
||||||
@@ -801,109 +694,35 @@ BOOLEAN IsBackGroundAllowed(UINT16 ubNumber)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case FORGETFUL:
|
case FORGETFUL:
|
||||||
if (zBackground[ubNumber].value[BG_INVENTORY] < 0 || zBackground[ubNumber].value[BG_ASSAULT] < 0 )
|
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case PSYCHO:
|
case PSYCHO:
|
||||||
if (zBackground[ubNumber].value[BG_LEADERSHIP] > 5)
|
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 )
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case DEAF:
|
|
||||||
if (zBackground[ ubNumber ].value[BG_PERC_HEARING_NIGHT] > 0 || zBackground[ ubNumber ].value[BG_PERC_HEARING_DAY] > 0)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case SHORTSIGHTED:
|
|
||||||
if (zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0 )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case HEMOPHILIAC:
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case AFRAID_OF_HEIGHTS:
|
case AFRAID_OF_HEIGHTS:
|
||||||
if ( zBackground[ ubNumber ].value[BG_HEIGHT] > 0 || zBackground[ubNumber].value[BG_AIRDROP] > 0 )
|
if ( zBackground[ubNumber].value[BG_HEIGHT] > 0 )
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case SELF_HARM:
|
|
||||||
if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Character Traits
|
switch ( iChosenCharacterTrait() )
|
||||||
switch (iChosenCharacterTrait())
|
|
||||||
{
|
{
|
||||||
case CHAR_TRAIT_SOCIABLE:
|
case CHAR_TRAIT_SOCIABLE:
|
||||||
if (zBackground[ubNumber].uiFlags & BACKGROUND_XENOPHOBIC || zBackground[ubNumber].value[BG_PERC_SPOTTER] < 0)
|
if ( zBackground[ ubNumber ].uiFlags & BACKGROUND_XENOPHOBIC )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case CHAR_TRAIT_LONER:
|
case CHAR_TRAIT_LONER:
|
||||||
if (zBackground[ubNumber].value[BG_LEADERSHIP] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0)
|
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 )
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_OPTIMIST:
|
|
||||||
if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_ASSERTIVE:
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_INTERROGATION] < 0 || zBackground[ubNumber].value[BG_PERC_APPROACH_THREATEN] < 0)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_INTELLECTUAL:
|
|
||||||
if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] < 0)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_PRIMITIVE:
|
|
||||||
if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] > 0)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_AGGRESSIVE:
|
|
||||||
if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL || zBackground[ubNumber].value[BG_PERC_DISARM] > 0 )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_PHLEGMATIC:
|
|
||||||
if (zBackground[ubNumber].value[BG_ASSAULT] > 0 )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_DAUNTLESS:
|
|
||||||
if (zBackground[ubNumber].value[BG_CROUCHEDDEFENSE] < 0 )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_PACIFIST:
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_MALICIOUS:
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_APPROACH_FRIENDLY] > 0)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_SHOWOFF:
|
|
||||||
break;
|
|
||||||
case CHAR_TRAIT_COWARD:
|
|
||||||
if (zBackground[ubNumber].value[BG_PERC_CAPITULATION] > 0)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show exclusivly the BG's with tag <alt_impcreation> if Reduced_Imp_Creation is true in ja2options.ini
|
|
||||||
// requires Alt_Imp_Creation to be true in ja2options.ini (otherwise BG's with tag <alt_impcreation> won't be shown)
|
|
||||||
|
|
||||||
if (gGameExternalOptions.fReducedIMPCreation)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ void RenderIMPDisabilityTrait( void );
|
|||||||
void ExitIMPDisabilityTrait( void );
|
void ExitIMPDisabilityTrait( void );
|
||||||
void HandleIMPDisabilityTrait( void );
|
void HandleIMPDisabilityTrait( void );
|
||||||
|
|
||||||
INT8 iChosenDisabilityTrait();
|
INT8 iChosenDisabilityTrait();
|
||||||
INT8 iPlayersAttributePointsBonusForDisabilitySelected();
|
INT8 iPlayersAttributePointsBonusForDisabilitySelected();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ UINT8 gusNewMinorTraitRemap[IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS] =
|
|||||||
|
|
||||||
BOOLEAN gfIMT_Redraw=FALSE;
|
BOOLEAN gfIMT_Redraw=FALSE;
|
||||||
|
|
||||||
BOOLEAN gfMinorTraitQuestions[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ];
|
BOOLEAN gfMinorTraitQuestions[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ];
|
||||||
|
|
||||||
// these are the buttons for the questions
|
// these are the buttons for the questions
|
||||||
INT32 giIMPMinorTraitAnswerButton[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ];
|
INT32 giIMPMinorTraitAnswerButton[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ];
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ UINT8 gusOldMajorTraitRemap[IMP_SKILL_TRAITS__NUMBER_SKILLS] =
|
|||||||
// Global Variables
|
// Global Variables
|
||||||
//
|
//
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
BOOLEAN gfSkillTraitQuestions[ 20 ];
|
BOOLEAN gfSkillTraitQuestions[ 20 ];
|
||||||
BOOLEAN gfSkillTraitQuestions2[ 20 ];
|
BOOLEAN gfSkillTraitQuestions2[ 20 ];
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN gfIST_Redraw=FALSE;
|
BOOLEAN gfIST_Redraw=FALSE;
|
||||||
|
|||||||
@@ -670,6 +670,13 @@ void AddCustomEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender,
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE );
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE );
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--
|
//--
|
||||||
@@ -714,6 +721,14 @@ void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 u
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM );
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM );
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,6 +761,14 @@ void AddEmailWithSpecialDataXML(INT32 iMessageOffset, INT32 iMessageLength, UINT
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM);
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, iFirstData, uiSecondData, -1 , -1, EmailType, EmailAIM);
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,6 +792,13 @@ void AddPreReadEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 u
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE );
|
AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE );
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType )
|
void AddEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iCurrentIMPPosition, UINT8 EmailType )
|
||||||
@@ -800,6 +830,13 @@ void AddEmailTypeXML( INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1, EmailType, TYPE_E_NONE);
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1, EmailType, TYPE_E_NONE);
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
if( fCurrentlyInLaptop )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
@@ -816,6 +853,14 @@ void AddBobbyREmailJA2(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSende
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_EMAIL_BOBBY_R_L1);
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_EMAIL_BOBBY_R_L1);
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -839,6 +884,14 @@ void AddEmailWFMercAvailable(INT32 iMessageOffset, INT32 iMessageLength, UINT8 u
|
|||||||
|
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1 , EmailType, TYPE_E_NONE);
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, -1 , EmailType, TYPE_E_NONE);
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,6 +931,14 @@ void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE);
|
AddEmailMessage(iMessageOffset,iMessageLength, pSubject, iDate, ubSender, FALSE, 0, 0, iCurrentIMPPosition, iCurrentShipmentDestinationID, EmailType, TYPE_E_NONE);
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,6 +968,13 @@ void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender,
|
|||||||
// add message to list
|
// add message to list
|
||||||
AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE );
|
AddEmailMessage( iMessageOffset,iMessageLength, pSubject, iDate, ubSender, TRUE, 0, 0, -1, -1 , EmailType, TYPE_E_NONE );
|
||||||
|
|
||||||
|
// if we are in fact int he laptop, redraw icons, might be change in mail status
|
||||||
|
|
||||||
|
if( fCurrentlyInLaptop == TRUE )
|
||||||
|
{
|
||||||
|
// redraw icons, might be new mail
|
||||||
|
DrawLapTopIcons();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1888,6 +1956,9 @@ void BtnMessageXCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
// reset page being displayed
|
// reset page being displayed
|
||||||
giMessagePage = 0;
|
giMessagePage = 0;
|
||||||
|
|
||||||
|
// redraw icons
|
||||||
|
DrawLapTopIcons();
|
||||||
|
|
||||||
// force update of entire screen
|
// force update of entire screen
|
||||||
fPausedReDrawScreenFlag=TRUE;
|
fPausedReDrawScreenFlag=TRUE;
|
||||||
|
|
||||||
@@ -2350,6 +2421,7 @@ BOOLEAN DisplayNewMailBox( void )
|
|||||||
|
|
||||||
// printf warning string
|
// printf warning string
|
||||||
mprintf(EMAIL_WARNING_X + 60, EMAIL_WARNING_Y + 63, pNewMailStrings[0] );
|
mprintf(EMAIL_WARNING_X + 60, EMAIL_WARNING_Y + 63, pNewMailStrings[0] );
|
||||||
|
DrawLapTopIcons( );
|
||||||
|
|
||||||
// invalidate region
|
// invalidate region
|
||||||
InvalidateRegion( EMAIL_WARNING_X, EMAIL_WARNING_Y, EMAIL_WARNING_X + 270, EMAIL_WARNING_Y + 200 );
|
InvalidateRegion( EMAIL_WARNING_X, EMAIL_WARNING_Y, EMAIL_WARNING_X + 270, EMAIL_WARNING_Y + 200 );
|
||||||
@@ -2811,6 +2883,9 @@ void DeleteEmail()
|
|||||||
// upadte list
|
// upadte list
|
||||||
PlaceMessagesinPages();
|
PlaceMessagesinPages();
|
||||||
|
|
||||||
|
// redraw icons (if deleted message was last unread, remove checkmark)
|
||||||
|
DrawLapTopIcons();
|
||||||
|
|
||||||
// if all of a sudden we are beyond last page, move back one
|
// if all of a sudden we are beyond last page, move back one
|
||||||
if(iCurrentPage > iLastPage)
|
if(iCurrentPage > iLastPage)
|
||||||
iCurrentPage=iLastPage;
|
iCurrentPage=iLastPage;
|
||||||
@@ -2962,6 +3037,9 @@ void ViewMessageRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
|||||||
// reset page being displayed
|
// reset page being displayed
|
||||||
giMessagePage = 0;
|
giMessagePage = 0;
|
||||||
|
|
||||||
|
// redraw icons
|
||||||
|
DrawLapTopIcons();
|
||||||
|
|
||||||
// force update of entire screen
|
// force update of entire screen
|
||||||
fPausedReDrawScreenFlag=TRUE;
|
fPausedReDrawScreenFlag=TRUE;
|
||||||
|
|
||||||
|
|||||||
@@ -837,6 +837,13 @@ BOOLEAN InitLaptopAndLaptopScreens()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT32
|
||||||
|
DrawLapTopIcons()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
UINT32
|
UINT32
|
||||||
DrawLapTopText()
|
DrawLapTopText()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ void ExitLaptop();
|
|||||||
void RenderLaptop();
|
void RenderLaptop();
|
||||||
UINT32 ExitLaptopMode(UINT32 uiMode);
|
UINT32 ExitLaptopMode(UINT32 uiMode);
|
||||||
void EnterNewLaptopMode();
|
void EnterNewLaptopMode();
|
||||||
|
UINT32 DrawLapTopIcons();
|
||||||
UINT32 DrawLapTopText();
|
UINT32 DrawLapTopText();
|
||||||
void ReDrawHighLight();
|
void ReDrawHighLight();
|
||||||
void DrawButtonText();
|
void DrawButtonText();
|
||||||
@@ -25,6 +26,7 @@ BOOLEAN IsBookMarkSet( INT32 iBookId );
|
|||||||
BOOLEAN LeaveLapTopScreen( );
|
BOOLEAN LeaveLapTopScreen( );
|
||||||
void SetLaptopExitScreen( UINT32 uiExitScreen );
|
void SetLaptopExitScreen( UINT32 uiExitScreen );
|
||||||
void SetLaptopNewGameFlag( );
|
void SetLaptopNewGameFlag( );
|
||||||
|
UINT32 DrawLapTopIcons( );
|
||||||
void LapTopScreenCallBack(MOUSE_REGION * pRegion, INT32 iReason );
|
void LapTopScreenCallBack(MOUSE_REGION * pRegion, INT32 iReason );
|
||||||
void HandleRightButtonUpEvent( void );
|
void HandleRightButtonUpEvent( void );
|
||||||
|
|
||||||
|
|||||||
+36
-21
@@ -13603,43 +13603,58 @@ static int l_GetNumHostilesInSector( lua_State *L )
|
|||||||
|
|
||||||
void LuaGetIntelAndQuestMapData( INT32 aLevel )
|
void LuaGetIntelAndQuestMapData( INT32 aLevel )
|
||||||
{
|
{
|
||||||
const char* filename = "scripts\\strategicmap.lua";
|
static LuaScopeState _LS(true);
|
||||||
|
static bool isInitialized = false;
|
||||||
|
|
||||||
LuaScopeState _LS( true );
|
// Initialize only once during lifetime of program
|
||||||
|
if (!isInitialized)
|
||||||
IniFunction( _LS.L(), TRUE );
|
{
|
||||||
IniGlobalGameSetting( _LS.L() );
|
isInitialized = true;
|
||||||
|
IniFunction(_LS.L(), TRUE);
|
||||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
IniGlobalGameSetting(_LS.L());
|
||||||
|
const char* filename = "scripts\\strategicmap.lua";
|
||||||
|
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
|
||||||
|
}
|
||||||
|
|
||||||
|
IniGlobalGameSetting(_LS.L());
|
||||||
LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 );
|
LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft )
|
void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft )
|
||||||
{
|
{
|
||||||
const char* filename = "scripts\\strategicmap.lua";
|
static LuaScopeState _LS(true);
|
||||||
|
static bool isInitialized = false;
|
||||||
|
|
||||||
LuaScopeState _LS( true );
|
// Initialize only once during lifetime of program
|
||||||
|
if (!isInitialized)
|
||||||
IniFunction( _LS.L(), TRUE );
|
{
|
||||||
IniGlobalGameSetting( _LS.L() );
|
isInitialized = true;
|
||||||
|
IniFunction(_LS.L(), TRUE);
|
||||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
IniGlobalGameSetting(_LS.L());
|
||||||
|
const char* filename = "scripts\\strategicmap.lua";
|
||||||
|
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
|
||||||
|
}
|
||||||
|
|
||||||
|
IniGlobalGameSetting(_LS.L());
|
||||||
LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 );
|
LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber )
|
INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber )
|
||||||
{
|
{
|
||||||
const char* filename = "scripts\\strategicmap.lua";
|
static LuaScopeState _LS( true );
|
||||||
|
static bool isInitialized = false;
|
||||||
|
|
||||||
LuaScopeState _LS( true );
|
// Initialize only once during lifetime of program
|
||||||
|
if (!isInitialized)
|
||||||
IniFunction( _LS.L(), TRUE );
|
{
|
||||||
IniGlobalGameSetting( _LS.L() );
|
isInitialized = true;
|
||||||
|
IniFunction( _LS.L(), TRUE );
|
||||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
IniGlobalGameSetting(_LS.L());
|
||||||
|
const char* filename = "scripts\\strategicmap.lua";
|
||||||
|
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||||
|
}
|
||||||
|
|
||||||
|
IniGlobalGameSetting(_LS.L());
|
||||||
LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 );
|
LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 );
|
||||||
|
|
||||||
if ( lua_gettop( _LS.L() ) >= 0 )
|
if ( lua_gettop( _LS.L() ) >= 0 )
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ void AutoBandage( BOOLEAN fStart )
|
|||||||
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier )
|
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier )
|
||||||
{
|
{
|
||||||
// 0verhaul: Make sure the merc is also in the sector before making him stand up!
|
// 0verhaul: Make sure the merc is also in the sector before making him stand up!
|
||||||
if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
|
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||||
{
|
{
|
||||||
ActionDone( pSoldier );
|
ActionDone( pSoldier );
|
||||||
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
||||||
@@ -483,16 +483,12 @@ void AutoBandage( BOOLEAN fStart )
|
|||||||
ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||||
for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop)
|
for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop)
|
||||||
{
|
{
|
||||||
pSoldier = MercPtrs[ubLoop];
|
ActionDone( MercPtrs[ ubLoop ] );
|
||||||
if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
|
|
||||||
{
|
|
||||||
ActionDone(pSoldier);
|
|
||||||
|
|
||||||
// If anyone is still doing aid animation, stop!
|
// If anyone is still doing aid animation, stop!
|
||||||
if (pSoldier->usAnimState == GIVING_AID || pSoldier->usAnimState == GIVING_AID_PRN)
|
if ( MercPtrs[ ubLoop ]->usAnimState == GIVING_AID || MercPtrs[ ubLoop ]->usAnimState == GIVING_AID_PRN )
|
||||||
{
|
{
|
||||||
pSoldier->SoldierGotoStationaryStance();
|
MercPtrs[ ubLoop ]->SoldierGotoStationaryStance( );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ set(TacticalSrc
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML.cpp"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp"
|
||||||
|
|||||||
+1
-3
@@ -364,9 +364,7 @@ void ReduceBPRegenForHunger( SOLDIERTYPE *pSoldier, INT32 *psPoints )
|
|||||||
|
|
||||||
void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier )
|
void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
// A merc away on a minievent assignment is ignored since we cannot control their food or water intake.
|
if ( !pSoldier )
|
||||||
// Without this they would end up losing stats and/or dying during long event assignments, which would lead to the game crashing when death occurs.
|
|
||||||
if ( !pSoldier || pSoldier->bAssignment == ASSIGNMENT_MINIEVENT)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// determine our current activity level
|
// determine our current activity level
|
||||||
|
|||||||
@@ -5769,6 +5769,14 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
|
|||||||
//search primary item launchables.xml
|
//search primary item launchables.xml
|
||||||
usAttachment = Launchable[usLoop][0];
|
usAttachment = Launchable[usLoop][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment))
|
||||||
|
{
|
||||||
|
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
|
||||||
|
{
|
||||||
|
attachList.push_back(usAttachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//search for launchables made valid by other attachments
|
//search for launchables made valid by other attachments
|
||||||
@@ -5777,22 +5785,11 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
|
|||||||
while (cnt)
|
while (cnt)
|
||||||
{
|
{
|
||||||
if (Launchable[usLoop][1] == *p && AttachmentSlots[usLoopSlotID].nasAttachmentClass & Item[Launchable[usLoop][0]].nasAttachmentClass)
|
if (Launchable[usLoop][1] == *p && AttachmentSlots[usLoopSlotID].nasAttachmentClass & Item[Launchable[usLoop][0]].nasAttachmentClass)
|
||||||
{
|
|
||||||
usAttachment = Launchable[usLoop][0];
|
usAttachment = Launchable[usLoop][0];
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cnt--, p++;
|
cnt--, p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment))
|
|
||||||
{
|
|
||||||
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
|
|
||||||
{
|
|
||||||
attachList.push_back(usAttachment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check all attachments
|
// check all attachments
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OBJECTTYPE::exists() const
|
bool OBJECTTYPE::exists()
|
||||||
{
|
{
|
||||||
return(this && ubNumberOfObjects && usItem);
|
return(this && ubNumberOfObjects && usItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ public:
|
|||||||
|
|
||||||
bool operator==(OBJECTTYPE& compare);
|
bool operator==(OBJECTTYPE& compare);
|
||||||
bool operator==(const OBJECTTYPE& compare)const;
|
bool operator==(const OBJECTTYPE& compare)const;
|
||||||
bool exists() const;
|
bool exists();
|
||||||
bool IsActiveLBE(unsigned int index);
|
bool IsActiveLBE(unsigned int index);
|
||||||
bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0);
|
bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0);
|
||||||
LBENODE* GetLBEPointer(unsigned int index);
|
LBENODE* GetLBEPointer(unsigned int index);
|
||||||
@@ -947,6 +947,9 @@ extern OBJECTTYPE gTempObject;
|
|||||||
// autofiretohitbonus,
|
// autofiretohitbonus,
|
||||||
// bursttohitbonus
|
// bursttohitbonus
|
||||||
|
|
||||||
|
// bitflags for usLimitedToSystem
|
||||||
|
#define FOOD_SYSTEM_FLAG 1
|
||||||
|
#define DISEASE_SYSTEM_FLAG 2
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -1215,9 +1218,8 @@ typedef struct
|
|||||||
BOOLEAN fProvidesRobotCamo;
|
BOOLEAN fProvidesRobotCamo;
|
||||||
BOOLEAN fProvidesRobotNightVision;
|
BOOLEAN fProvidesRobotNightVision;
|
||||||
BOOLEAN fProvidesRobotLaserBonus;
|
BOOLEAN fProvidesRobotLaserBonus;
|
||||||
|
//shadooow: bitflag controlling what system needs to be in play for item to appear
|
||||||
// kitty: item exclusively available with disease feature
|
UINT8 usLimitedToSystem;
|
||||||
BOOLEAN DiseaseSystemExclusive;
|
|
||||||
|
|
||||||
// rftr: the progress bounds that allow a transport group to drop an item
|
// rftr: the progress bounds that allow a transport group to drop an item
|
||||||
INT8 iTransportGroupMinProgress;
|
INT8 iTransportGroupMinProgress;
|
||||||
|
|||||||
+2
-3
@@ -1279,9 +1279,8 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// kitty: no disease items if the disease system is off
|
//shadooow: exclude also any item that is limited to specific system and this system isn't enabled
|
||||||
// whether the item is exclusive is defined by tag
|
if (((Item[usItemIndex].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[usItemIndex].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
|
||||||
if (!gGameExternalOptions.fDisease && Item[usItemIndex].DiseaseSystemExclusive)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-11
@@ -5081,17 +5081,11 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe
|
|||||||
INT16 sDesiredLevel;
|
INT16 sDesiredLevel;
|
||||||
BOOLEAN fOKCheckStruct;
|
BOOLEAN fOKCheckStruct;
|
||||||
|
|
||||||
// Allow civilians and NPCs with profile to go off screen, and also enemies if tactical retreat is enabled
|
// sevenfm: allow civilians and NPCs with profile to go off screen
|
||||||
auto destinationOffscreen = !(GridNoOnVisibleWorldTile(sGridNo));
|
if (!GridNoOnVisibleWorldTile(sGridNo) && (pCurrSoldier->bTeam != CIV_TEAM || pCurrSoldier->ubProfile == NO_PROFILE))
|
||||||
auto hasProfile = pCurrSoldier->ubProfile != NO_PROFILE;
|
{
|
||||||
auto isCivilian = pCurrSoldier->bTeam == CIV_TEAM;
|
return(FALSE);
|
||||||
auto isEnemy = pCurrSoldier->bTeam == ENEMY_TEAM;
|
}
|
||||||
auto retreatAllowed = gGameExternalOptions.fAITacticalRetreat == true;
|
|
||||||
|
|
||||||
if (destinationOffscreen && !(isCivilian || hasProfile || (isEnemy && retreatAllowed)))
|
|
||||||
{
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
|
if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY )
|
||||||
{
|
{
|
||||||
|
|||||||
+19
-19
@@ -461,7 +461,7 @@ static auto canJumpFences(SOLDIERTYPE* pSoldier) -> bool {
|
|||||||
//ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off,
|
//ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off,
|
||||||
//but a safer path, usually farther away from an enemy or following behind some cover.
|
//but a safer path, usually farther away from an enemy or following behind some cover.
|
||||||
//however it has not been tested and it may need some work, I haven't touched it in a while
|
//however it has not been tested and it may need some work, I haven't touched it in a while
|
||||||
#define ASTAR_USING_EXTRACOVER
|
//#define ASTAR_USING_EXTRACOVER
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ASTAR;
|
using namespace ASTAR;
|
||||||
@@ -1164,7 +1164,7 @@ void AStarPathfinder::ExecuteAStarLogic()
|
|||||||
#ifdef ASTAR_USING_EXTRACOVER
|
#ifdef ASTAR_USING_EXTRACOVER
|
||||||
//check if we will run out of AP while entering this node or before
|
//check if we will run out of AP while entering this node or before
|
||||||
//if we run out, the merc will stop at the parent node for a turn and be vulnerable
|
//if we run out, the merc will stop at the parent node for a turn and be vulnerable
|
||||||
if (gfTurnBasedAI && mercsMaxAPs && AStarG > mercsMaxAPs)
|
if (mercsMaxAPs && APCost > mercsMaxAPs)
|
||||||
{
|
{
|
||||||
|
|
||||||
extraGCoverCost = GetExtraGCover(ParentNode);
|
extraGCoverCost = GetExtraGCover(ParentNode);
|
||||||
@@ -1174,7 +1174,7 @@ void AStarPathfinder::ExecuteAStarLogic()
|
|||||||
//use the stance and cover to see how much we really want to stop at the parent node
|
//use the stance and cover to see how much we really want to stop at the parent node
|
||||||
//as opposed to an equal path with different cover
|
//as opposed to an equal path with different cover
|
||||||
//because other nodes further on the path will stop here too, add this value to the F cost
|
//because other nodes further on the path will stop here too, add this value to the F cost
|
||||||
extraGCoverCost = CalcGCover(ParentNode, AStarG);
|
extraGCoverCost = CalcGCover(ParentNodeIndex, APCost);
|
||||||
|
|
||||||
//remember, we have run out of points to *enter* this node, so we are stuck at the *parent* node
|
//remember, we have run out of points to *enter* this node, so we are stuck at the *parent* node
|
||||||
//cache the cost to stay at the parent node
|
//cache the cost to stay at the parent node
|
||||||
@@ -1512,9 +1512,9 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
INT32 iMyThreatValue;
|
INT32 iMyThreatValue;
|
||||||
INT16 sThreatLoc;
|
INT16 sThreatLoc;
|
||||||
UINT32 uiThreatCnt = 0;
|
UINT32 uiThreatCnt = 0;
|
||||||
INT32* pusLastLoc;
|
INT16 * pusLastLoc;
|
||||||
INT8 * pbPersOL;
|
INT8 * pbPersOL;
|
||||||
INT8 * pbPublOL;
|
INT8 * pbPublOL;
|
||||||
|
|
||||||
//although we have run out of APs to get here, it could just mean we have some APs but not enough to enter
|
//although we have run out of APs to get here, it could just mean we have some APs but not enough to enter
|
||||||
int APLeft = this->mercsMaxAPs - APCost;
|
int APLeft = this->mercsMaxAPs - APCost;
|
||||||
@@ -1523,7 +1523,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]);
|
pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]);
|
||||||
|
|
||||||
// hang a pointer into personal opplist
|
// hang a pointer into personal opplist
|
||||||
pbPersOL = &(pSoldier->aiData.bOppList[0]);
|
pbPersOL = &(pSoldier->bOppList[0]);
|
||||||
// hang a pointer into public opplist
|
// hang a pointer into public opplist
|
||||||
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]);
|
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]);
|
||||||
|
|
||||||
@@ -1535,7 +1535,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
SOLDIERTYPE* pOpponent = MercSlots[ uiLoop ];
|
SOLDIERTYPE* pOpponent = MercSlots[ uiLoop ];
|
||||||
|
|
||||||
// if this merc is inactive, at base, on assignment, dead, unconscious
|
// if this merc is inactive, at base, on assignment, dead, unconscious
|
||||||
if (!pOpponent || pOpponent->stats.bLife < OKLIFE) {
|
if (!pOpponent || pOpponent->bLife < OKLIFE) {
|
||||||
continue; // next merc
|
continue; // next merc
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1544,7 +1544,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
continue; // next merc
|
continue; // next merc
|
||||||
}
|
}
|
||||||
|
|
||||||
pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID;
|
pbPersOL = pSoldier->bOppList + pOpponent->ubID;
|
||||||
pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID;
|
pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID;
|
||||||
pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID;
|
pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID;
|
||||||
|
|
||||||
@@ -1554,7 +1554,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Special stuff for Carmen the bounty hunter
|
// Special stuff for Carmen the bounty hunter
|
||||||
if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) {
|
if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) {
|
||||||
continue; // next opponent
|
continue; // next opponent
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1599,7 +1599,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
|
|||||||
Threats[uiThreatCnt].iOrigRange = iThreatRange;
|
Threats[uiThreatCnt].iOrigRange = iThreatRange;
|
||||||
|
|
||||||
// calculate how many APs he will have at the start of the next turn
|
// calculate how many APs he will have at the start of the next turn
|
||||||
Threats[uiThreatCnt].iAPs = pOpponent->CalcActionPoints();
|
Threats[uiThreatCnt].iAPs = CalcActionPoints(pOpponent);
|
||||||
|
|
||||||
if (iThreatRange < iClosestThreatRange) {
|
if (iThreatRange < iClosestThreatRange) {
|
||||||
iClosestThreatRange = iThreatRange;
|
iClosestThreatRange = iThreatRange;
|
||||||
@@ -1641,7 +1641,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
|||||||
INT32 myThreatsiValue, INT32 myThreatsiAPs, INT32 myThreatsiCertainty)
|
INT32 myThreatsiValue, INT32 myThreatsiAPs, INT32 myThreatsiCertainty)
|
||||||
{
|
{
|
||||||
SOLDIERTYPE* pMe = this->pSoldier;
|
SOLDIERTYPE* pMe = this->pSoldier;
|
||||||
INT32 morale = pSoldier->aiData.bAIMorale;
|
INT32 morale = pSoldier->bAIMorale;
|
||||||
|
|
||||||
INT32 iRange = myThreatsiOrigRange;
|
INT32 iRange = myThreatsiOrigRange;
|
||||||
// all 32-bit integers for max. speed
|
// all 32-bit integers for max. speed
|
||||||
@@ -1690,7 +1690,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// optimistically assume we'll be behind the best cover available at this spot
|
// optimistically assume we'll be behind the best cover available at this spot
|
||||||
bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft );
|
bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft );
|
||||||
}
|
}
|
||||||
|
|
||||||
// normally, that will be the cover I'll use, unless worst case over-rides it
|
// normally, that will be the cover I'll use, unless worst case over-rides it
|
||||||
@@ -1709,7 +1709,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate where my cover is worst if opponent moves just 1 tile over
|
// calculate where my cover is worst if opponent moves just 1 tile over
|
||||||
bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft);
|
bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft);
|
||||||
|
|
||||||
// if he can actually improve his CTGT by moving to a nearby gridno
|
// if he can actually improve his CTGT by moving to a nearby gridno
|
||||||
if (bHisBestCTGT > bHisActualCTGT)
|
if (bHisBestCTGT > bHisActualCTGT)
|
||||||
@@ -1738,7 +1738,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
|||||||
|
|
||||||
// let's not assume anything about the stance the enemy might take, so take an average
|
// let's not assume anything about the stance the enemy might take, so take an average
|
||||||
// value... no cover give a higher value than partial cover
|
// value... no cover give a higher value than partial cover
|
||||||
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft );
|
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->bLevel, iMyAPsLeft );
|
||||||
|
|
||||||
// since NPCs are too dumb to shoot "blind", ie. at opponents that they
|
// since NPCs are too dumb to shoot "blind", ie. at opponents that they
|
||||||
// themselves can't see (mercs can, using another as a spotter!), if the
|
// themselves can't see (mercs can, using another as a spotter!), if the
|
||||||
@@ -1768,14 +1768,14 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
|
|||||||
|
|
||||||
// try to account for who outnumbers who: the side with the advantage thus
|
// try to account for who outnumbers who: the side with the advantage thus
|
||||||
// (hopefully) values offense more, while those in trouble will play defense
|
// (hopefully) values offense more, while those in trouble will play defense
|
||||||
if (pHim->aiData.bOppCnt > 1)
|
if (pHim->bOppCnt > 1)
|
||||||
{
|
{
|
||||||
HisPosValue /= pHim->aiData.bOppCnt;
|
HisPosValue /= pHim->bOppCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMe->aiData.bOppCnt > 1)
|
if (pMe->bOppCnt > 1)
|
||||||
{
|
{
|
||||||
MyPosValue /= pMe->aiData.bOppCnt;
|
MyPosValue /= pMe->bOppCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2896,6 +2896,13 @@ BOOLEAN DetermineArmsDealersSellingInventory( )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//shadooow: do not sell any item that is limited to specific system and this system isn't enabled
|
||||||
|
if (((Item[iter->object.usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[iter->object.usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
|
||||||
|
{
|
||||||
|
++iter;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool increment = true;
|
bool increment = true;
|
||||||
if (ItemIsSpecial(*iter) == false) {
|
if (ItemIsSpecial(*iter) == false) {
|
||||||
StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID );
|
StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID );
|
||||||
|
|||||||
@@ -378,10 +378,6 @@ unsigned int Inventory::size( ) const {
|
|||||||
return inv.size( );
|
return inv.size( );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Inventory::get() const -> const std::vector<OBJECTTYPE>& {
|
|
||||||
return inv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assignment operator
|
// Assignment operator
|
||||||
Inventory& Inventory::operator=(const Inventory& src)
|
Inventory& Inventory::operator=(const Inventory& src)
|
||||||
{
|
{
|
||||||
@@ -19938,19 +19934,22 @@ FLOAT SOLDIERTYPE::GetDiseaseContactProtection( )
|
|||||||
// if we wear special equipment, lower our chances of being infected
|
// if we wear special equipment, lower our chances of being infected
|
||||||
FLOAT bestfacegear = 0.0f;
|
FLOAT bestfacegear = 0.0f;
|
||||||
FLOAT bestprotectivegear = 0.0f;
|
FLOAT bestprotectivegear = 0.0f;
|
||||||
for ( const auto &item : inv.get() )
|
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
|
||||||
{
|
{
|
||||||
if ( item.exists( ) )
|
if ( inv[bLoop].exists( ) )
|
||||||
{
|
{
|
||||||
if ( item[0]->data.objectStatus >= USABLE )
|
OBJECTTYPE* pObj = &(inv[bLoop]);
|
||||||
|
|
||||||
|
if ( pObj && (*pObj)[0]->data.objectStatus >= USABLE )
|
||||||
{
|
{
|
||||||
if ( HasItemFlag( item.usItem, DISEASEPROTECTION_1 ) )
|
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_1 ) )
|
||||||
{
|
{
|
||||||
bestfacegear = max( bestfacegear, (FLOAT)(item[0]->data.objectStatus / 100) );
|
bestfacegear = max( bestfacegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) );
|
||||||
}
|
}
|
||||||
if ( HasItemFlag( item.usItem, DISEASEPROTECTION_2 ) )
|
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_2 ) )
|
||||||
{
|
{
|
||||||
bestprotectivegear = max( bestprotectivegear, (FLOAT)(item[0]->data.objectStatus / 100) );
|
bestprotectivegear = max( bestprotectivegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -466,13 +466,12 @@ enum
|
|||||||
|
|
||||||
#define BACKGROUND_ANIMALFRIEND 0x0000000000000200 //512 // refuses to attack animals
|
#define BACKGROUND_ANIMALFRIEND 0x0000000000000200 //512 // refuses to attack animals
|
||||||
#define BACKGROUND_CIVGROUPLOYAL 0x0000000000000400 //1024 // refuses to attack members of the same civgroup
|
#define BACKGROUND_CIVGROUPLOYAL 0x0000000000000400 //1024 // refuses to attack members of the same civgroup
|
||||||
#define BACKGROUND_ALT_IMP_CREATION 0x0000000000000800 //2048 // BG can only be used when ALT_IMP_CREATION is TRUE in ja2options.ini (IMP creation)
|
|
||||||
|
|
||||||
#define BACKGROUND_FLAG_MAX 12 // number of flagged backgrounds - keep this updated, or properties will get lost!
|
#define BACKGROUND_FLAG_MAX 11 // number of flagged backgrounds - keep this updated, or properties will get lost!
|
||||||
|
|
||||||
// some properties are hidden (forbid background in MP creation)
|
// some properties are hidden (forbid background in MP creation)
|
||||||
// corruption property is not relevant in 1.13
|
// corruption property is not relevant in 1.13
|
||||||
#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD|BACKGROUND_ALT_IMP_CREATION)
|
#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD)
|
||||||
|
|
||||||
// anv: externalised taunts
|
// anv: externalised taunts
|
||||||
// taunt properties
|
// taunt properties
|
||||||
@@ -772,9 +771,6 @@ public:
|
|||||||
// How any slots are there in this inventory?
|
// How any slots are there in this inventory?
|
||||||
unsigned int size() const;
|
unsigned int size() const;
|
||||||
|
|
||||||
// const-only accessor
|
|
||||||
auto get() const -> const std::vector<OBJECTTYPE>&;
|
|
||||||
|
|
||||||
//temporarily? public
|
//temporarily? public
|
||||||
std::vector<int> bNewItemCount;
|
std::vector<int> bNewItemCount;
|
||||||
std::vector<int> bNewItemCycleCount;
|
std::vector<int> bNewItemCycleCount;
|
||||||
|
|||||||
@@ -3176,7 +3176,7 @@ void SaveWorldItemsToTempFiles()
|
|||||||
const auto y = gAllWorldItems.sectors[i].y;
|
const auto y = gAllWorldItems.sectors[i].y;
|
||||||
const auto z = gAllWorldItems.sectors[i].z;
|
const auto z = gAllWorldItems.sectors[i].z;
|
||||||
const auto nItems = gAllWorldItems.NumItems[i];
|
const auto nItems = gAllWorldItems.NumItems[i];
|
||||||
auto &Items = gAllWorldItems.Items[i];
|
auto Items = gAllWorldItems.Items[i];
|
||||||
|
|
||||||
SaveWorldItemsToTempItemFile(x, y, (INT8)z, nItems, Items);
|
SaveWorldItemsToTempItemFile(x, y, (INT8)z, nItems, Items);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8318,7 +8318,7 @@ void HandleTBBackpacks(void)
|
|||||||
{
|
{
|
||||||
pTeamSoldier = MercPtrs[ubLoop];
|
pTeamSoldier = MercPtrs[ubLoop];
|
||||||
|
|
||||||
if (OK_CONTROLLABLE_MERC(pTeamSoldier) && pTeamSoldier->flags.DropPackFlag)
|
if (pTeamSoldier->flags.DropPackFlag)
|
||||||
{
|
{
|
||||||
backpackDropped = true;
|
backpackDropped = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5692,7 +5692,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
|
|||||||
if ( pBullet->fFragment == false)
|
if ( pBullet->fFragment == false)
|
||||||
{
|
{
|
||||||
INT16 sX, sY;
|
INT16 sX, sY;
|
||||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY);
|
||||||
|
|
||||||
if ( Item[usWeaponIndex].singleshotrocketlauncher )
|
if ( Item[usWeaponIndex].singleshotrocketlauncher )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#include "XML.h"
|
|
||||||
|
|
||||||
const XML_Char* GetAttribute(const XML_Char* name, const XML_Char** atts) {
|
|
||||||
for (const XML_Char** pIter = atts; *pIter != NULL; pIter++) {
|
|
||||||
const XML_Char* key = *pIter++;
|
|
||||||
if (strcmp(key, name) == 0) return *pIter;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef __XML_H
|
#ifndef __XML_H
|
||||||
#define __XML_H
|
#define __XML_H
|
||||||
|
|
||||||
#include "expat.h"
|
|
||||||
#include "armsdealerinvinit.h"
|
#include "armsdealerinvinit.h"
|
||||||
#include "EnemyItemDrops.h"
|
#include "EnemyItemDrops.h"
|
||||||
#include "Loading Screen.h"
|
#include "Loading Screen.h"
|
||||||
@@ -582,6 +581,4 @@ extern BOOLEAN ReadInAimOldArchive(STR fileName, BOOLEAN localizedVersion);
|
|||||||
extern BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion );
|
extern BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion );
|
||||||
extern BOOLEAN ReadInDifficultySettings(STR fileName, BOOLEAN localizedVersion);
|
extern BOOLEAN ReadInDifficultySettings(STR fileName, BOOLEAN localizedVersion);
|
||||||
|
|
||||||
extern const XML_Char* GetAttribute(const XML_Char* name, const XML_Char** atts);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
|
|||||||
strcmp(name, "no_female") == 0 ||
|
strcmp(name, "no_female") == 0 ||
|
||||||
strcmp(name, "loyalitylossondeath" ) == 0 ||
|
strcmp(name, "loyalitylossondeath" ) == 0 ||
|
||||||
strcmp(name, "animal_friend") == 0 ||
|
strcmp(name, "animal_friend") == 0 ||
|
||||||
strcmp(name, "civgroup_loyal") == 0 ||
|
strcmp(name, "civgroup_loyal") == 0 ))
|
||||||
strcmp(name, "alt_impcreation") == 0 ))
|
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_PROPERTY;
|
pData->curElement = ELEMENT_PROPERTY;
|
||||||
|
|
||||||
@@ -169,7 +168,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
|
|||||||
else if (strcmp(name, "drugitems") == 0 && pData->curElement == ELEMENT)
|
else if (strcmp(name, "drugitems") == 0 && pData->curElement == ELEMENT)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;
|
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;
|
||||||
pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_ITEMS].clear();
|
pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_TYPES].clear();
|
||||||
|
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
@@ -694,19 +693,6 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0;
|
pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0;
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "alt_impcreation") == 0)
|
|
||||||
{
|
|
||||||
pData->curElement = ELEMENT;
|
|
||||||
pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_ALT_IMP_CREATION : 0;
|
|
||||||
}
|
|
||||||
else if (strcmp(name, "drugtypes") == 0)
|
|
||||||
{
|
|
||||||
pData->curElement = ELEMENT;
|
|
||||||
}
|
|
||||||
else if (strcmp(name, "drugitems") == 0)
|
|
||||||
{
|
|
||||||
pData->curElement = ELEMENT;
|
|
||||||
}
|
|
||||||
else if (strcmp(name, "drugtype") == 0)
|
else if (strcmp(name, "drugtype") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;
|
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;
|
||||||
|
|||||||
+33
-18
@@ -70,21 +70,21 @@ opinionStartElementHandle(void *userData, const XML_Char *name, const XML_Char *
|
|||||||
|
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
else if (pData->curElement == ELEMENT && strcmp(name, "AnOpinion") == 0)
|
else if(pData->curElement == ELEMENT)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
for(UINT8 i = 0; i < NUMBER_OF_OPINIONS; ++i)
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
|
||||||
|
|
||||||
XML_Char const* anID = GetAttribute("id", atts);
|
|
||||||
XML_Char const* modifier = GetAttribute("modifier", atts);
|
|
||||||
|
|
||||||
INT32 id, value;
|
|
||||||
id = atoi(anID);
|
|
||||||
value = atoi(modifier);
|
|
||||||
|
|
||||||
if (id >= 0 && id < NUMBER_OF_OPINIONS)
|
|
||||||
{
|
{
|
||||||
pData->curProfile.bMercOpinion[id] = value;
|
XML_Char bla[12];
|
||||||
|
sprintf(bla, "Opinion%d", i);
|
||||||
|
|
||||||
|
if(strcmp(name, bla) == 0)
|
||||||
|
{
|
||||||
|
pData->curElement = ELEMENT_PROPERTY;
|
||||||
|
|
||||||
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,8 +92,8 @@ opinionStartElementHandle(void *userData, const XML_Char *name, const XML_Char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
pData->currentDepth++;
|
pData->currentDepth++;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
opinionCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
opinionCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||||
@@ -149,6 +149,24 @@ opinionEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curIndex = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
pData->curIndex = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(UINT8 i = 0; i < NUMBER_OF_OPINIONS; ++i)
|
||||||
|
{
|
||||||
|
XML_Char bla[12];
|
||||||
|
sprintf(bla, "Opinion%d", i);
|
||||||
|
|
||||||
|
if(strcmp(name, bla) == 0)
|
||||||
|
{
|
||||||
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
|
pData->curProfile.bMercOpinion[i] = (INT8) atol(pData->szCharData);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pData->maxReadDepth--;
|
pData->maxReadDepth--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,10 +315,7 @@ BOOLEAN WriteMercOpinions()
|
|||||||
UINT8 cnt_b = 0;
|
UINT8 cnt_b = 0;
|
||||||
for (cnt_b = 0; cnt_b < NUMBER_OF_OPINIONS; ++cnt_b)
|
for (cnt_b = 0; cnt_b < NUMBER_OF_OPINIONS; ++cnt_b)
|
||||||
{
|
{
|
||||||
if (gMercProfiles[cnt].bMercOpinion[cnt_b] != 0)
|
FilePrintf(hFile,"\t\t<Opinion%d>%d</Opinion%d>\r\n", cnt_b, gMercProfiles[ cnt ].bMercOpinion[cnt_b], cnt_b);
|
||||||
{
|
|
||||||
FilePrintf(hFile, "\t\t<AnOpinion id = \"%d\" modifier = \"%d\" />\r\n", cnt_b, gMercProfiles[cnt].bMercOpinion[cnt_b]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -626,6 +626,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named
|
|||||||
if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION )
|
if ( pSoldier->aiData.bNewSituation == IS_NEW_SITUATION )
|
||||||
{
|
{
|
||||||
BOOLEAN fProcessNewSituation;
|
BOOLEAN fProcessNewSituation;
|
||||||
|
BOOLEAN fProcessNewSituation2 = TRUE;
|
||||||
|
|
||||||
// if this happens during an attack then do nothing... wait for the A.B.C.
|
// if this happens during an attack then do nothing... wait for the A.B.C.
|
||||||
// to be reduced to 0 first -- CJC December 13th
|
// to be reduced to 0 first -- CJC December 13th
|
||||||
@@ -750,9 +751,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named
|
|||||||
if (pSoldier->aiData.bAction >= FIRST_MOVEMENT_ACTION && pSoldier->aiData.bAction <= LAST_MOVEMENT_ACTION && !pSoldier->flags.fDelayedMovement)
|
if (pSoldier->aiData.bAction >= FIRST_MOVEMENT_ACTION && pSoldier->aiData.bAction <= LAST_MOVEMENT_ACTION && !pSoldier->flags.fDelayedMovement)
|
||||||
{
|
{
|
||||||
if (pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize)
|
if (pSoldier->pathing.usPathIndex == pSoldier->pathing.usPathDataSize)
|
||||||
{
|
{
|
||||||
INT8 bEscapeDirection = NOWHERE;
|
|
||||||
|
|
||||||
if (!TileIsOutOfBounds(pSoldier->sAbsoluteFinalDestination))
|
if (!TileIsOutOfBounds(pSoldier->sAbsoluteFinalDestination))
|
||||||
{
|
{
|
||||||
if ( !ACTING_ON_SCHEDULE( pSoldier ) && SpacesAway( pSoldier->sGridNo, pSoldier->sAbsoluteFinalDestination ) < 4 )
|
if ( !ACTING_ON_SCHEDULE( pSoldier ) && SpacesAway( pSoldier->sGridNo, pSoldier->sAbsoluteFinalDestination ) < 4 )
|
||||||
@@ -793,8 +792,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for regular guys still have to check for leaving the map
|
// for regular guys still have to check for leaving the map
|
||||||
else if (pSoldier->ubQuoteActionID >= QUOTE_ACTION_ID_TRAVERSE_EAST && pSoldier->ubQuoteActionID <= QUOTE_ACTION_ID_TRAVERSE_NORTH &&
|
else if (pSoldier->ubQuoteActionID >= QUOTE_ACTION_ID_TRAVERSE_EAST && pSoldier->ubQuoteActionID <= QUOTE_ACTION_ID_TRAVERSE_NORTH)
|
||||||
GridNoOnEdgeOfMap(pSoldier->sGridNo, &bEscapeDirection) && EscapeDirectionIsValid(&bEscapeDirection))
|
|
||||||
{
|
{
|
||||||
HandleAITacticalTraversal( pSoldier );
|
HandleAITacticalTraversal( pSoldier );
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "Isometric Utils.h"
|
#include "Isometric Utils.h"
|
||||||
#include "Rotting Corpses.h"
|
#include "Rotting Corpses.h"
|
||||||
|
|
||||||
|
#define ANOTHERNEWVAR 1
|
||||||
|
|
||||||
#define TESTAICONTROL
|
#define TESTAICONTROL
|
||||||
|
|
||||||
extern INT16 gubAIPathCosts[19][19];
|
extern INT16 gubAIPathCosts[19][19];
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ UINT32 guiEXTRABUFFER = 0;
|
|||||||
|
|
||||||
BOOLEAN gfExtraBuffer = FALSE;
|
BOOLEAN gfExtraBuffer = FALSE;
|
||||||
|
|
||||||
|
BOOLEAN InitializeSystemVideoObjects( )
|
||||||
|
{
|
||||||
|
|
||||||
|
return( TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN InitializeGameVideoObjects( )
|
BOOLEAN InitializeGameVideoObjects( )
|
||||||
{
|
{
|
||||||
VSURFACE_DESC vs_desc;
|
VSURFACE_DESC vs_desc;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ extern UINT32 guiEXTRABUFFER;
|
|||||||
|
|
||||||
extern BOOLEAN gfExtraBuffer;
|
extern BOOLEAN gfExtraBuffer;
|
||||||
|
|
||||||
|
BOOLEAN InitializeSystemVideoObjects( );
|
||||||
BOOLEAN InitializeGameVideoObjects( );
|
BOOLEAN InitializeGameVideoObjects( );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,6 +4,7 @@ set(UtilsSrc
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Cinematics.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Cinematics.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Cursors.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Cursors.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Debug Control.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Debug Control.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/dsutil.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Encrypted File.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Encrypted File.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Event Pump.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Event Pump.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString );
|
|||||||
|
|
||||||
#define DATA_8_BIT_DIR "8-Bit\\"
|
#define DATA_8_BIT_DIR "8-Bit\\"
|
||||||
|
|
||||||
|
BOOLEAN PerformTimeLimitedCheck();
|
||||||
|
|
||||||
// WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece"
|
// WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece"
|
||||||
/*
|
/*
|
||||||
@@ -294,6 +295,64 @@ BOOLEAN IfWin95(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HandleLimitedNumExecutions( )
|
||||||
|
{
|
||||||
|
// Get system directory
|
||||||
|
HWFILE hFileHandle;
|
||||||
|
CHAR8 ubSysDir[ 512 ];
|
||||||
|
INT8 bNumRuns;
|
||||||
|
|
||||||
|
GetSystemDirectory( (LPSTR) ubSysDir, sizeof( ubSysDir ) );
|
||||||
|
|
||||||
|
// Append filename
|
||||||
|
strcat( ubSysDir, "\\winaese.dll" );
|
||||||
|
|
||||||
|
// Open file and check # runs...
|
||||||
|
if ( FileExists( (STR)ubSysDir ) )
|
||||||
|
{
|
||||||
|
// Open and read
|
||||||
|
if ( ( hFileHandle = FileOpen( (STR)ubSysDir, FILE_ACCESS_READ, FALSE)) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read value
|
||||||
|
FileRead( hFileHandle, &bNumRuns, sizeof( bNumRuns ) , NULL);
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
FileClose( hFileHandle );
|
||||||
|
|
||||||
|
if ( bNumRuns <= 0 )
|
||||||
|
{
|
||||||
|
// Fail!
|
||||||
|
SET_ERROR( "Error 1054: Cannot execute - contact Sir-Tech Software." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bNumRuns = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OK, decrement # runs...
|
||||||
|
bNumRuns--;
|
||||||
|
|
||||||
|
// Open and write
|
||||||
|
if ( ( hFileHandle = FileOpen( (STR)ubSysDir, FILE_ACCESS_WRITE, FALSE)) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write value
|
||||||
|
FileWrite( hFileHandle, &bNumRuns, sizeof( bNumRuns ) , NULL);
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
FileClose( hFileHandle );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SGPFILENAME gCheckFilenames[] =
|
SGPFILENAME gCheckFilenames[] =
|
||||||
{
|
{
|
||||||
"DATA\\INTRO.SLF",
|
"DATA\\INTRO.SLF",
|
||||||
@@ -312,7 +371,65 @@ UINT32 gCheckFileMinSizes[] =
|
|||||||
187000000,
|
187000000,
|
||||||
236000000
|
236000000
|
||||||
};
|
};
|
||||||
|
#define NOCDCHECK
|
||||||
|
|
||||||
|
#if defined( JA2TESTVERSION ) || defined( _DEBUG )
|
||||||
|
#define NOCDCHECK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( RUSSIANGOLD )
|
||||||
|
// CD check enabled
|
||||||
|
#else
|
||||||
|
#define NOCDCHECK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOLEAN HandleJA2CDCheck( )
|
||||||
|
{
|
||||||
|
#ifdef TIME_LIMITED_VERSION
|
||||||
|
if( !PerformTimeLimitedCheck() )
|
||||||
|
{
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return( TRUE );
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN HandleJA2CDCheckTwo( )
|
||||||
|
{
|
||||||
|
|
||||||
|
return( TRUE );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN PerformTimeLimitedCheck()
|
||||||
|
{
|
||||||
|
#ifndef TIME_LIMITED_VERSION
|
||||||
|
return( TRUE );
|
||||||
|
|
||||||
|
#else
|
||||||
|
SYSTEMTIME sSystemTime;
|
||||||
|
|
||||||
|
GetSystemTime( &sSystemTime );
|
||||||
|
|
||||||
|
|
||||||
|
//if according to the system clock, we are past july 1999, quit the game
|
||||||
|
if( sSystemTime.wYear > 1999 || sSystemTime.wMonth > 7 )
|
||||||
|
{
|
||||||
|
//spit out an error message
|
||||||
|
MessageBox( NULL, "This time limited version of Jagged Alliance 2 v1.13 has expired.", "Ja2 Error!", MB_OK );
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( TRUE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation )
|
BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont );
|
|||||||
BOOLEAN IfWinNT(void);
|
BOOLEAN IfWinNT(void);
|
||||||
BOOLEAN IfWin95(void);
|
BOOLEAN IfWin95(void);
|
||||||
|
|
||||||
|
void HandleLimitedNumExecutions( );
|
||||||
|
|
||||||
|
BOOLEAN HandleJA2CDCheck( );
|
||||||
|
BOOLEAN HandleJA2CDCheckTwo( );
|
||||||
|
|
||||||
// WANNE: This method replaces characters in a given text with new characters
|
// WANNE: This method replaces characters in a given text with new characters
|
||||||
STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece);
|
STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece);
|
||||||
|
|||||||
@@ -0,0 +1,344 @@
|
|||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
|
#include <dsound.h>
|
||||||
|
#include "dsutil.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include "sgp.h"
|
||||||
|
|
||||||
|
#include "Sound Control.h"
|
||||||
|
|
||||||
|
// THIS MODULE IS TEMPORARY - USED FOR OUR SOUND SYSTEM INTIL IT IS IMPLEMENTED FOR THE SGP
|
||||||
|
extern HWND ghWindow;
|
||||||
|
typedef UINT32 EFFECT;
|
||||||
|
|
||||||
|
BOOL DSEnable( HWND hwnd );
|
||||||
|
BOOL DSDisable( void );
|
||||||
|
BOOL SoundLoadEffect( EFFECT sfx );
|
||||||
|
BOOL SoundDestroyEffect( EFFECT sfx );
|
||||||
|
BOOL InitSound( HWND hwndOwner );
|
||||||
|
BOOL SoundPlayEffect( EFFECT sfx );
|
||||||
|
|
||||||
|
|
||||||
|
void EnableQuickSound( )
|
||||||
|
{
|
||||||
|
DSEnable( ghWindow );
|
||||||
|
InitSound( ghWindow );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableQuickSound( )
|
||||||
|
{
|
||||||
|
DSDisable( );
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayQuickSound( INT16 sSound )
|
||||||
|
{
|
||||||
|
SoundPlayEffect( (EFFECT)sSound );
|
||||||
|
}
|
||||||
|
|
||||||
|
#define NUM_SOUND_EFFECTS NUM_SAMPLES
|
||||||
|
|
||||||
|
LPDIRECTSOUND lpDS = NULL;
|
||||||
|
LPDIRECTSOUNDBUFFER lpSoundEffects[NUM_SOUND_EFFECTS];
|
||||||
|
|
||||||
|
|
||||||
|
extern char szSoundEffects[MAX_SAMPLES][255];
|
||||||
|
//char szSoundEffects[NUM_SOUND_EFFECTS][255] =
|
||||||
|
//char szSoundEffects[MAX_SAMPLES][255] =
|
||||||
|
//{
|
||||||
|
// "SHOOT1",
|
||||||
|
// "MISS1",
|
||||||
|
// "FALL1",
|
||||||
|
// "HIT1",
|
||||||
|
// "HIT2",
|
||||||
|
// "DOOROPEN1",
|
||||||
|
// "DOORCLOSE1",
|
||||||
|
// "BURST1",
|
||||||
|
// "ENDTURN"
|
||||||
|
//};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSEnable
|
||||||
|
*
|
||||||
|
* Figures out whether or not to use DirectSound, based on an entry
|
||||||
|
* in WIN.INI. Sets a module-level flag and goes about creating the
|
||||||
|
* DirectSound object if necessary. Returns TRUE if successful.
|
||||||
|
*/
|
||||||
|
BOOL DSEnable( HWND hwnd )
|
||||||
|
{
|
||||||
|
HRESULT dsrval;
|
||||||
|
//BOOL bUseDSound;
|
||||||
|
|
||||||
|
if (lpDS != NULL)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dsrval = DirectSoundCreate(NULL, &lpDS, NULL);
|
||||||
|
|
||||||
|
switch( dsrval )
|
||||||
|
{
|
||||||
|
case DSERR_ALLOCATED:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DSERR_NOAGGREGATION:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DSERR_OUTOFMEMORY:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DSERR_INVALIDPARAM:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case DSERR_NODRIVER:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dsrval != DS_OK)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dsrval = IDirectSound_SetCooperativeLevel(lpDS, hwnd, DSSCL_NORMAL);
|
||||||
|
|
||||||
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Sound INIT OK");
|
||||||
|
|
||||||
|
if (dsrval != DS_OK)
|
||||||
|
{
|
||||||
|
DSDisable();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
} /* DSEnable */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSDisable
|
||||||
|
*
|
||||||
|
* Turn off DirectSound
|
||||||
|
*/
|
||||||
|
BOOL DSDisable( void )
|
||||||
|
{
|
||||||
|
if (lpDS == NULL)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectSound_Release(lpDS);
|
||||||
|
lpDS = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
} /* DSDisable */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* InitSound
|
||||||
|
*
|
||||||
|
* Sets up the DirectSound object and loads all sounds into secondary
|
||||||
|
* DirectSound buffers. Returns FALSE on error, or TRUE if successful
|
||||||
|
*/
|
||||||
|
BOOL InitSound( HWND hwndOwner )
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
DSBUFFERDESC dsBD;
|
||||||
|
IDirectSoundBuffer *lpPrimary;
|
||||||
|
|
||||||
|
DSEnable(hwndOwner);
|
||||||
|
|
||||||
|
if (lpDS == NULL)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load all sounds -- any that can't load for some reason will have NULL
|
||||||
|
* pointers instead of valid SOUNDEFFECT data, and we will know not to
|
||||||
|
* play them later on.
|
||||||
|
*/
|
||||||
|
for( idx = 0; idx < NUM_SOUND_EFFECTS; idx++ )
|
||||||
|
{
|
||||||
|
if (SoundLoadEffect((EFFECT)idx))
|
||||||
|
{
|
||||||
|
DSBCAPS caps;
|
||||||
|
|
||||||
|
caps.dwSize = sizeof(caps);
|
||||||
|
IDirectSoundBuffer_GetCaps(lpSoundEffects[idx], &caps);
|
||||||
|
|
||||||
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("_______SOUND(%d) OK", idx));
|
||||||
|
|
||||||
|
//if (caps.dwFlags & DSBCAPS_LOCHARDWARE)
|
||||||
|
//Msg( "Sound effect %s in hardware", szSoundEffects[idx]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("_______SOUND(%d) BAD", idx));
|
||||||
|
|
||||||
|
//Msg( "cant load sound effect %s", szSoundEffects[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get the primary buffer and start it playing
|
||||||
|
*
|
||||||
|
* by playing the primary buffer, DirectSound knows to keep the
|
||||||
|
* mixer active, even though we are not making any noise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZeroMemory( &dsBD, sizeof(DSBUFFERDESC) );
|
||||||
|
dsBD.dwSize = sizeof(dsBD);
|
||||||
|
dsBD.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||||
|
|
||||||
|
if (SUCCEEDED(IDirectSound_CreateSoundBuffer(lpDS, &dsBD, &lpPrimary, NULL)))
|
||||||
|
{
|
||||||
|
if (!SUCCEEDED(IDirectSoundBuffer_Play(lpPrimary, 0, 0, DSBPLAY_LOOPING)))
|
||||||
|
{
|
||||||
|
//Msg("Unable to play Primary sound buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectSoundBuffer_Release(lpPrimary);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Msg("Unable to create Primary sound buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
} /* InitSound */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DestroySound
|
||||||
|
*
|
||||||
|
* Undoes everything that was done in a InitSound call
|
||||||
|
*/
|
||||||
|
BOOL DestroySound( void )
|
||||||
|
{
|
||||||
|
DWORD idxKill;
|
||||||
|
|
||||||
|
for( idxKill = 0; idxKill < NUM_SOUND_EFFECTS; idxKill++ )
|
||||||
|
{
|
||||||
|
SoundDestroyEffect( (EFFECT)idxKill );
|
||||||
|
}
|
||||||
|
|
||||||
|
DSDisable();
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
} /* DestroySound */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SoundDestroyEffect
|
||||||
|
*
|
||||||
|
* Frees up resources associated with a sound effect
|
||||||
|
*/
|
||||||
|
BOOL SoundDestroyEffect( EFFECT sfx )
|
||||||
|
{
|
||||||
|
if(lpSoundEffects[sfx])
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer_Release(lpSoundEffects[sfx]);
|
||||||
|
lpSoundEffects[sfx] = NULL;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
} /* SoundDestryEffect */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SoundLoadEffect
|
||||||
|
*
|
||||||
|
* Initializes a sound effect by loading the WAV file from a resource
|
||||||
|
*/
|
||||||
|
BOOL SoundLoadEffect( EFFECT sfx )
|
||||||
|
{
|
||||||
|
if (lpDS && lpSoundEffects[sfx] == NULL && *szSoundEffects[sfx])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// use DSLoadSoundBuffer (in ..\misc\dsutil.c) to load
|
||||||
|
// a sound from a resource.
|
||||||
|
//
|
||||||
|
lpSoundEffects[sfx] = DSLoadSoundBuffer(lpDS, szSoundEffects[sfx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lpSoundEffects[sfx] != NULL;
|
||||||
|
|
||||||
|
} /* SoundLoadEffect */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SoundPlayEffect
|
||||||
|
*
|
||||||
|
* Plays the sound effect specified.
|
||||||
|
* Returns TRUE if succeeded.
|
||||||
|
*/
|
||||||
|
BOOL SoundPlayEffect( EFFECT sfx )
|
||||||
|
{
|
||||||
|
HRESULT dsrval;
|
||||||
|
IDirectSoundBuffer *pdsb = lpSoundEffects[sfx];
|
||||||
|
|
||||||
|
if( !lpDS || !pdsb )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rewind the play cursor to the start of the effect, and play
|
||||||
|
*/
|
||||||
|
IDirectSoundBuffer_SetCurrentPosition(pdsb, 0);
|
||||||
|
dsrval = IDirectSoundBuffer_Play(pdsb, 0, 0, 0);
|
||||||
|
|
||||||
|
if( dsrval == DS_OK )
|
||||||
|
|
||||||
|
if (dsrval == DSERR_BUFFERLOST)
|
||||||
|
{
|
||||||
|
//Msg("** %s needs restored", szSoundEffects[sfx]);
|
||||||
|
|
||||||
|
dsrval = IDirectSoundBuffer_Restore(pdsb);
|
||||||
|
|
||||||
|
if (dsrval == DS_OK)
|
||||||
|
{
|
||||||
|
if (DSReloadSoundBuffer(pdsb, szSoundEffects[sfx]))
|
||||||
|
{
|
||||||
|
//Msg("** %s has been restored", szSoundEffects[sfx]);
|
||||||
|
IDirectSoundBuffer_SetCurrentPosition(pdsb, 0);
|
||||||
|
dsrval = IDirectSoundBuffer_Play(pdsb, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsrval = E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dsrval == DS_OK);
|
||||||
|
|
||||||
|
} /* SoundPlayEffect */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SoundStopEffect
|
||||||
|
*
|
||||||
|
* Stops the sound effect specified.
|
||||||
|
* Returns TRUE if succeeded.
|
||||||
|
*/
|
||||||
|
BOOL SoundStopEffect( EFFECT sfx )
|
||||||
|
{
|
||||||
|
HRESULT dsrval;
|
||||||
|
|
||||||
|
if( !lpDS || !lpSoundEffects[sfx] )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dsrval = IDirectSoundBuffer_Stop(lpSoundEffects[sfx]);
|
||||||
|
|
||||||
|
return SUCCEEDED(dsrval);
|
||||||
|
|
||||||
|
} /* SoundStopEffect */
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef __WIN_UTIL_H
|
||||||
|
#define __WIN_UTIL_H
|
||||||
|
|
||||||
|
|
||||||
|
void SetThreadToHighestPriority( );
|
||||||
|
|
||||||
|
void EnableQuickSound( );
|
||||||
|
void DisableQuickSound( );
|
||||||
|
void PlayQuickSound( INT16 sSound );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
+10
-4
@@ -306,6 +306,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
|
|||||||
strcmp(name, "ProvidesRobotCamo") == 0 ||
|
strcmp(name, "ProvidesRobotCamo") == 0 ||
|
||||||
strcmp(name, "ProvidesRobotNightVision") == 0 ||
|
strcmp(name, "ProvidesRobotNightVision") == 0 ||
|
||||||
strcmp(name, "ProvidesRobotLaserBonus") == 0 ||
|
strcmp(name, "ProvidesRobotLaserBonus") == 0 ||
|
||||||
|
strcmp(name, "FoodSystemExclusive") == 0 ||
|
||||||
strcmp(name, "DiseaseSystemExclusive") == 0 ||
|
strcmp(name, "DiseaseSystemExclusive") == 0 ||
|
||||||
strcmp(name, "TransportGroupMinProgress") == 0 ||
|
strcmp(name, "TransportGroupMinProgress") == 0 ||
|
||||||
strcmp(name, "TransportGroupMaxProgress") == 0
|
strcmp(name, "TransportGroupMaxProgress") == 0
|
||||||
@@ -1514,10 +1515,17 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curItem.fProvidesRobotLaserBonus = (BOOLEAN)atol(pData->szCharData);
|
pData->curItem.fProvidesRobotLaserBonus = (BOOLEAN)atol(pData->szCharData);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(name, "FoodSystemExclusive") == 0)
|
||||||
|
{
|
||||||
|
pData->curElement = ELEMENT;
|
||||||
|
if (atol(pData->szCharData))
|
||||||
|
pData->curItem.usLimitedToSystem|= FOOD_SYSTEM_FLAG;
|
||||||
|
}
|
||||||
else if (strcmp(name, "DiseaseSystemExclusive") == 0)
|
else if (strcmp(name, "DiseaseSystemExclusive") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData);
|
if (atol(pData->szCharData))
|
||||||
|
pData->curItem.usLimitedToSystem|= DISEASE_SYSTEM_FLAG;
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "TransportGroupMinProgress") == 0)
|
else if (strcmp(name, "TransportGroupMinProgress") == 0)
|
||||||
{
|
{
|
||||||
@@ -2186,8 +2194,6 @@ BOOLEAN WriteItemStats()
|
|||||||
FilePrintf(hFile,"\t\t<ProvidesRobotNightVision>%d</ProvidesRobotNightVision>\r\n", Item[cnt].fProvidesRobotNightVision );
|
FilePrintf(hFile,"\t\t<ProvidesRobotNightVision>%d</ProvidesRobotNightVision>\r\n", Item[cnt].fProvidesRobotNightVision );
|
||||||
FilePrintf(hFile,"\t\t<ProvidesRobotLaserBonus>%d</ProvidesRobotLaserBonus>\r\n", Item[cnt].fProvidesRobotLaserBonus );
|
FilePrintf(hFile,"\t\t<ProvidesRobotLaserBonus>%d</ProvidesRobotLaserBonus>\r\n", Item[cnt].fProvidesRobotLaserBonus );
|
||||||
|
|
||||||
FilePrintf(hFile, "\t\t<DiseaseSystemExclusive>%d</DiseaseSystemExclusive>\r\n", Item[cnt].DiseaseSystemExclusive);
|
|
||||||
|
|
||||||
FilePrintf(hFile,"\t</ITEM>\r\n");
|
FilePrintf(hFile,"\t</ITEM>\r\n");
|
||||||
}
|
}
|
||||||
FilePrintf(hFile,"</ITEMLIST>\r\n");
|
FilePrintf(hFile,"</ITEMLIST>\r\n");
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ STR16 gzIMPMajorTraitsHelpTextsRadioOperator[]=
|
|||||||
L"Kann Artillerieunterstützung von Verbündeten in Nachbarsektoren anfordern\n",
|
L"Kann Artillerieunterstützung von Verbündeten in Nachbarsektoren anfordern\n",
|
||||||
L"Kann Funkfrequenzen abhören und feindliche Truppen aufspüren\n",
|
L"Kann Funkfrequenzen abhören und feindliche Truppen aufspüren\n",
|
||||||
L"Kann den Funkverkehr im ganzen Sektor stören\n",
|
L"Kann den Funkverkehr im ganzen Sektor stören\n",
|
||||||
L"Kann nach feindlichen Störsendern suchen, wenn solche aktiv sind\n",
|
L"Kann nach feindlichen Störsendern suchen, wenn solche aktiv sind\n"
|
||||||
L"Kann Unterstützung durch Milizen aus Nachbarsektoren anfordern\n",
|
L"Kann Unterstützung durch Milizen aus Nachbarsektoren anfordern\n",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,372 @@
|
|||||||
|
// THIS MODULE IS TEMPORARY - USED FOR OUR SOUND SYSTEM INTIL IT IS IMPLEMENTED FOR THE SGP
|
||||||
|
// TAKEN FROM MS SAMPLES FOR DirectSound
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
|
#include <dsound.h>
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
BYTE *pbWaveData; // pointer into wave resource (for restore)
|
||||||
|
DWORD cbWaveSize; // size of wave data (for restore)
|
||||||
|
int iAlloc; // number of buffers.
|
||||||
|
int iCurrent; // current buffer
|
||||||
|
IDirectSoundBuffer* Buffers[1]; // list of buffers
|
||||||
|
|
||||||
|
} SNDOBJ, *HSNDOBJ;
|
||||||
|
|
||||||
|
#define _HSNDOBJ_DEFINED
|
||||||
|
#include "dsutil.h"
|
||||||
|
|
||||||
|
static const char c_szWAV[] = "WAVE";
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSLoadSoundBuffer
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName)
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer *pDSB = NULL;
|
||||||
|
DSBUFFERDESC dsBD = {0};
|
||||||
|
BYTE *pbWaveData;
|
||||||
|
|
||||||
|
if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes))
|
||||||
|
{
|
||||||
|
dsBD.dwSize = sizeof(dsBD);
|
||||||
|
dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLDEFAULT; // | DSBCAPS_GETCURRENTPOSITION2;
|
||||||
|
|
||||||
|
if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL)))
|
||||||
|
{
|
||||||
|
if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes))
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer_Release(pDSB);
|
||||||
|
pDSB = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDSB = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pDSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSReloadSoundBuffer
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName)
|
||||||
|
{
|
||||||
|
BOOL result=FALSE;
|
||||||
|
BYTE *pbWaveData;
|
||||||
|
DWORD cbWaveSize;
|
||||||
|
|
||||||
|
if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize))
|
||||||
|
{
|
||||||
|
if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) &&
|
||||||
|
DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize))
|
||||||
|
{
|
||||||
|
result = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSGetWaveResource
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName,
|
||||||
|
WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize)
|
||||||
|
{
|
||||||
|
HRSRC hResInfo;
|
||||||
|
HGLOBAL hResData;
|
||||||
|
void *pvRes;
|
||||||
|
|
||||||
|
if (((hResInfo = FindResource(hModule, lpName, c_szWAV)) != NULL) &&
|
||||||
|
((hResData = LoadResource(hModule, hResInfo)) != NULL) &&
|
||||||
|
((pvRes = LockResource(hResData)) != NULL) &&
|
||||||
|
DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SndObj fns
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
SNDOBJ *SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent)
|
||||||
|
{
|
||||||
|
SNDOBJ *pSO = NULL;
|
||||||
|
LPWAVEFORMATEX pWaveHeader;
|
||||||
|
BYTE *pbData;
|
||||||
|
UINT cbData;
|
||||||
|
|
||||||
|
if (DSGetWaveResource(NULL, lpName, &pWaveHeader, &pbData, (DWORD *)&cbData))
|
||||||
|
{
|
||||||
|
if (iConcurrent < 1)
|
||||||
|
iConcurrent = 1;
|
||||||
|
|
||||||
|
if ((pSO = (SNDOBJ *)LocalAlloc(LPTR, sizeof(SNDOBJ) +
|
||||||
|
(iConcurrent-1) * sizeof(IDirectSoundBuffer *))) != NULL)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
pSO->iAlloc = iConcurrent;
|
||||||
|
pSO->pbWaveData = pbData;
|
||||||
|
pSO->cbWaveSize = cbData;
|
||||||
|
pSO->Buffers[0] = DSLoadSoundBuffer(pDS, lpName);
|
||||||
|
|
||||||
|
for (i=1; i<pSO->iAlloc; i++)
|
||||||
|
{
|
||||||
|
if (FAILED(IDirectSound_DuplicateSoundBuffer(pDS,
|
||||||
|
pSO->Buffers[0], &pSO->Buffers[i])))
|
||||||
|
{
|
||||||
|
pSO->Buffers[i] = DSLoadSoundBuffer(pDS, lpName);
|
||||||
|
if (!pSO->Buffers[i]) {
|
||||||
|
SndObjDestroy(pSO);
|
||||||
|
pSO = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pSO;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void SndObjDestroy(SNDOBJ *pSO)
|
||||||
|
{
|
||||||
|
if (pSO)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<pSO->iAlloc; i++)
|
||||||
|
{
|
||||||
|
if (pSO->Buffers[i])
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer_Release(pSO->Buffers[i]);
|
||||||
|
pSO->Buffers[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LocalFree((HANDLE)pSO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IDirectSoundBuffer *SndObjGetFreeBuffer(SNDOBJ *pSO)
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer *pDSB;
|
||||||
|
|
||||||
|
if (pSO == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (pDSB = pSO->Buffers[pSO->iCurrent])
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
DWORD dwStatus;
|
||||||
|
|
||||||
|
hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus);
|
||||||
|
|
||||||
|
if (FAILED(hres))
|
||||||
|
dwStatus = 0;
|
||||||
|
|
||||||
|
if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING)
|
||||||
|
{
|
||||||
|
if (pSO->iAlloc > 1)
|
||||||
|
{
|
||||||
|
if (++pSO->iCurrent >= pSO->iAlloc)
|
||||||
|
pSO->iCurrent = 0;
|
||||||
|
|
||||||
|
pDSB = pSO->Buffers[pSO->iCurrent];
|
||||||
|
hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hres) && (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING)
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer_Stop(pDSB);
|
||||||
|
IDirectSoundBuffer_SetCurrentPosition(pDSB, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDSB = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDSB && (dwStatus & DSBSTATUS_BUFFERLOST))
|
||||||
|
{
|
||||||
|
if (FAILED(IDirectSoundBuffer_Restore(pDSB)) ||
|
||||||
|
!DSFillSoundBuffer(pDSB, pSO->pbWaveData, pSO->cbWaveSize))
|
||||||
|
{
|
||||||
|
pDSB = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pDSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL SndObjPlay(SNDOBJ *pSO, DWORD dwPlayFlags)
|
||||||
|
{
|
||||||
|
BOOL result = FALSE;
|
||||||
|
|
||||||
|
if (pSO == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ((!(dwPlayFlags & DSBPLAY_LOOPING) || (pSO->iAlloc == 1)))
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(pSO);
|
||||||
|
if (pDSB != NULL) {
|
||||||
|
result = SUCCEEDED(IDirectSoundBuffer_Play(pDSB, 0, 0, dwPlayFlags));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL SndObjStop(SNDOBJ *pSO)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (pSO == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (i=0; i<pSO->iAlloc; i++)
|
||||||
|
{
|
||||||
|
IDirectSoundBuffer_Stop(pSO->Buffers[i]);
|
||||||
|
IDirectSoundBuffer_SetCurrentPosition(pSO->Buffers[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize)
|
||||||
|
{
|
||||||
|
if (pDSB && pbWaveData && cbWaveSize)
|
||||||
|
{
|
||||||
|
LPVOID pMem1, pMem2;
|
||||||
|
DWORD dwSize1, dwSize2;
|
||||||
|
|
||||||
|
if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize,
|
||||||
|
&pMem1, &dwSize1, &pMem2, &dwSize2, 0)))
|
||||||
|
{
|
||||||
|
CopyMemory(pMem1, pbWaveData, dwSize1);
|
||||||
|
|
||||||
|
if ( 0 != dwSize2 )
|
||||||
|
CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2);
|
||||||
|
|
||||||
|
IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData,DWORD *pcbWaveSize)
|
||||||
|
{
|
||||||
|
DWORD *pdw;
|
||||||
|
DWORD *pdwEnd;
|
||||||
|
DWORD dwRiff;
|
||||||
|
DWORD dwType;
|
||||||
|
DWORD dwLength;
|
||||||
|
|
||||||
|
if (ppWaveHeader)
|
||||||
|
*ppWaveHeader = NULL;
|
||||||
|
|
||||||
|
if (ppbWaveData)
|
||||||
|
*ppbWaveData = NULL;
|
||||||
|
|
||||||
|
if (pcbWaveSize)
|
||||||
|
*pcbWaveSize = 0;
|
||||||
|
|
||||||
|
pdw = (DWORD *)pvRes;
|
||||||
|
dwRiff = *pdw++;
|
||||||
|
dwLength = *pdw++;
|
||||||
|
dwType = *pdw++;
|
||||||
|
|
||||||
|
if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F'))
|
||||||
|
goto exit; // not even RIFF
|
||||||
|
|
||||||
|
if (dwType != mmioFOURCC('W', 'A', 'V', 'E'))
|
||||||
|
goto exit; // not a WAV
|
||||||
|
|
||||||
|
pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4);
|
||||||
|
|
||||||
|
while (pdw < pdwEnd)
|
||||||
|
{
|
||||||
|
dwType = *pdw++;
|
||||||
|
dwLength = *pdw++;
|
||||||
|
|
||||||
|
switch (dwType)
|
||||||
|
{
|
||||||
|
case mmioFOURCC('f', 'm', 't', ' '):
|
||||||
|
if (ppWaveHeader && !*ppWaveHeader)
|
||||||
|
{
|
||||||
|
if (dwLength < sizeof(WAVEFORMAT))
|
||||||
|
goto exit; // not a WAV
|
||||||
|
|
||||||
|
*ppWaveHeader = (WAVEFORMATEX *)pdw;
|
||||||
|
|
||||||
|
if ((!ppbWaveData || *ppbWaveData) &&
|
||||||
|
(!pcbWaveSize || *pcbWaveSize))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case mmioFOURCC('d', 'a', 't', 'a'):
|
||||||
|
if ((ppbWaveData && !*ppbWaveData) ||
|
||||||
|
(pcbWaveSize && !*pcbWaveSize))
|
||||||
|
{
|
||||||
|
if (ppbWaveData)
|
||||||
|
*ppbWaveData = (LPBYTE)pdw;
|
||||||
|
|
||||||
|
if (pcbWaveSize)
|
||||||
|
*pcbWaveSize = dwLength;
|
||||||
|
|
||||||
|
if (!ppWaveHeader || *ppWaveHeader)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1));
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
+215
@@ -0,0 +1,215 @@
|
|||||||
|
/*==========================================================================
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 Microsoft Corporation. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* File: dsutil.cpp
|
||||||
|
* Content: Routines for dealing with sounds from resources
|
||||||
|
*
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSLoadSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in
|
||||||
|
// the current application.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// pDS -- Pointer to an IDirectSound that will be used to create
|
||||||
|
// the buffer.
|
||||||
|
//
|
||||||
|
// lpName -- Name of WAV resource to load the data from. Can be a
|
||||||
|
// resource id specified using the MAKEINTRESOURCE macro.
|
||||||
|
//
|
||||||
|
// Returns an IDirectSoundBuffer containing the wave data or NULL on error.
|
||||||
|
//
|
||||||
|
// example:
|
||||||
|
// in the application's resource script (.RC file)
|
||||||
|
// Turtle WAV turtle.wav
|
||||||
|
//
|
||||||
|
// some code in the application:
|
||||||
|
// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "Turtle");
|
||||||
|
//
|
||||||
|
// if (pDSB)
|
||||||
|
// {
|
||||||
|
// IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND);
|
||||||
|
// /* ... */
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSReloadSoundBuffer Reloads an IDirectSoundBuffer from a Win32 resource in
|
||||||
|
// the current application. normally used to handle
|
||||||
|
// a DSERR_BUFFERLOST error.
|
||||||
|
// Params:
|
||||||
|
// pDSB -- Pointer to an IDirectSoundBuffer to be reloaded.
|
||||||
|
//
|
||||||
|
// lpName -- Name of WAV resource to load the data from. Can be a
|
||||||
|
// resource id specified using the MAKEINTRESOURCE macro.
|
||||||
|
//
|
||||||
|
// Returns a BOOL indicating whether the buffer was successfully reloaded.
|
||||||
|
//
|
||||||
|
// example:
|
||||||
|
// in the application's resource script (.RC file)
|
||||||
|
// Turtle WAV turtle.wav
|
||||||
|
//
|
||||||
|
// some code in the application:
|
||||||
|
// TryAgain:
|
||||||
|
// HRESULT hres = IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND);
|
||||||
|
//
|
||||||
|
// if (FAILED(hres))
|
||||||
|
// {
|
||||||
|
// if ((hres == DSERR_BUFFERLOST) &&
|
||||||
|
// DSReloadSoundBuffer(pDSB, "Turtle"))
|
||||||
|
// {
|
||||||
|
// goto TryAgain;
|
||||||
|
// }
|
||||||
|
// /* deal with other errors... */
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DSGetWaveResource Finds a WAV resource in a Win32 module.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// hModule -- Win32 module handle of module containing WAV resource.
|
||||||
|
// Pass NULL to indicate current application.
|
||||||
|
//
|
||||||
|
// lpName -- Name of WAV resource to load the data from. Can be a
|
||||||
|
// resource id specified using the MAKEINTRESOURCE macro.
|
||||||
|
//
|
||||||
|
// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to
|
||||||
|
// the WAVEFORMATEX header in the specified WAV resource.
|
||||||
|
// Pass NULL if not required.
|
||||||
|
//
|
||||||
|
// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the
|
||||||
|
// waveform data in the specified WAV resource. Pass NULL if
|
||||||
|
// not required.
|
||||||
|
//
|
||||||
|
// pdwWaveSize -- Optional pointer to DWORD to receive the size of the
|
||||||
|
// waveform data in the specified WAV resource. Pass NULL if
|
||||||
|
// not required.
|
||||||
|
//
|
||||||
|
// Returns a BOOL indicating whether a valid WAV resource was found.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName,
|
||||||
|
WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// HSNDOBJ Handle to a SNDOBJ object.
|
||||||
|
//
|
||||||
|
// SNDOBJs are implemented in dsutil as an example layer built on top
|
||||||
|
// of DirectSound.
|
||||||
|
//
|
||||||
|
// A SNDOBJ is generally used to manage individual
|
||||||
|
// sounds which need to be played multiple times concurrently. A
|
||||||
|
// SNDOBJ represents a queue of IDirectSoundBuffer objects which
|
||||||
|
// all refer to the same buffer memory.
|
||||||
|
//
|
||||||
|
// A SNDOBJ also automatically reloads the sound resource when
|
||||||
|
// DirectSound returns a DSERR_BUFFERLOST
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef _HSNDOBJ_DEFINED
|
||||||
|
DECLARE_HANDLE32(HSNDOBJ);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SndObjCreate Loads a SNDOBJ from a Win32 resource in
|
||||||
|
// the current application.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// pDS -- Pointer to an IDirectSound that will be used to create
|
||||||
|
// the SNDOBJ.
|
||||||
|
//
|
||||||
|
// lpName -- Name of WAV resource to load the data from. Can be a
|
||||||
|
// resource id specified using the MAKEINTRESOURCE macro.
|
||||||
|
//
|
||||||
|
// iConcurrent -- Integer representing the number of concurrent playbacks of
|
||||||
|
// to plan for. Attempts to play more than this number will
|
||||||
|
// succeed but will restart the least recently played buffer
|
||||||
|
// even if it is not finished playing yet.
|
||||||
|
//
|
||||||
|
// Returns an HSNDOBJ or NULL on error.
|
||||||
|
//
|
||||||
|
// NOTES:
|
||||||
|
// SNDOBJs automatically restore and reload themselves as required.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
HSNDOBJ SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SndObjDestroy Frees a SNDOBJ and releases all of its buffers.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// hSO -- Handle to a SNDOBJ to free.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
void SndObjDestroy(HSNDOBJ hSO);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SndObjPlay Plays a buffer in a SNDOBJ.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// hSO -- Handle to a SNDOBJ to play a buffer from.
|
||||||
|
//
|
||||||
|
// dwPlayFlags -- Flags to pass to IDirectSoundBuffer::Play. It is not
|
||||||
|
// legal to play an SndObj which has more than one buffer
|
||||||
|
// with the DSBPLAY_LOOPING flag. Pass 0 to stop playback.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
BOOL SndObjPlay(HSNDOBJ hSO, DWORD dwPlayFlags);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SndObjStop Stops one or more buffers in a SNDOBJ.
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// hSO -- Handle to a SNDOBJ to play a buffer from.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
BOOL SndObjStop(HSNDOBJ hSO);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SndObjGetFreeBuffer returns one of the cloned buffers that is
|
||||||
|
// not currently playing
|
||||||
|
//
|
||||||
|
// Params:
|
||||||
|
// hSO -- Handle to a SNDOBJ
|
||||||
|
//
|
||||||
|
// NOTES:
|
||||||
|
// This function is provided so that callers can set things like pan etc
|
||||||
|
// before playing the buffer.
|
||||||
|
//
|
||||||
|
// EXAMPLE:
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
IDirectSoundBuffer *SndObjGetFreeBuffer(HSNDOBJ hSO);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// helper routines
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD dwWaveSize);
|
||||||
|
BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -856,6 +856,11 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
|||||||
//Process the command line BEFORE initialization
|
//Process the command line BEFORE initialization
|
||||||
ProcessJa2CommandLineBeforeInitialization( pCommandLine );
|
ProcessJa2CommandLineBeforeInitialization( pCommandLine );
|
||||||
|
|
||||||
|
// Handle Check for CD
|
||||||
|
if ( !HandleJA2CDCheck( ) )
|
||||||
|
{
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// ShowCursor(FALSE);
|
// ShowCursor(FALSE);
|
||||||
|
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ void ShutdownSoundManager(void)
|
|||||||
|
|
||||||
SoundStopAll();
|
SoundStopAll();
|
||||||
SoundShutdownCache();
|
SoundShutdownCache();
|
||||||
|
Sleep(1000);
|
||||||
SoundShutdownHardware();
|
SoundShutdownHardware();
|
||||||
fSoundSystemInit=FALSE;
|
fSoundSystemInit=FALSE;
|
||||||
SoundLog("JA2 sound manager shutdown");
|
SoundLog("JA2 sound manager shutdown");
|
||||||
|
|||||||
Reference in New Issue
Block a user