Skip to content

Commit

Permalink
Add BULL mod (#55)
Browse files Browse the repository at this point in the history
* Remove old comment

* Add BULL, b69dcab9ea1ae226e6c9d31343ae96947c0ac131 from RFCDOC

* Format

* Add missing files BULL, 022026b395b7d7c24c9795aaac851e4a801e3d41 from RFCDOC

* Fix

* Add dll
  • Loading branch information
VDuchauffour authored Aug 22, 2024
1 parent c0981a4 commit 51532aa
Show file tree
Hide file tree
Showing 76 changed files with 9,649 additions and 1,352 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@
"todo-tree.general.tags": ["HACK", "FIXME", "TODO", "XXX", "[ ]", "[x]"],
"files.exclude": {
"Autolog": true
},
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
"cstdlib": "cpp"
}
}
Binary file modified Assets/CvGameCoreDLL.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<TEXT>
<Tag>TXT_ACO_VS</Tag>
<English>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] vs. [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</English>
<French>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] vs. [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</French>
<French>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] contre [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</French>
<German>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] gegen [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</German>
<Italian>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] vs. [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</Italian>
<Spanish>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] vs. [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</Spanish>
<Italian>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] contro [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</Italian>
<Spanish>[COLOR_POSITIVE_TEXT]%s1[COLOR_REVERT] contra [COLOR_NEGATIVE_TEXT]%s2[COLOR_REVERT]</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_ACO_BarbFreeWinsLeft</Tag>
Expand All @@ -29,7 +29,7 @@
<Tag>TXT_ACO_SurvivalOdds</Tag>
<English>Survival odds:[SPACE]</English>
<French>Chances de survie:[SPACE]</French>
<German>&#220;berlebenswahrscheinlichkeit:[SPACE]</German>
<German>&#220;berlebenschance:[SPACE]</German>
<Italian>Probabilit&#224; di sopravvivenza:[SPACE]</Italian>
<Spanish>Probabilidad de sobrevivencia:[SPACE]</Spanish>
</TEXT>
Expand Down Expand Up @@ -85,7 +85,7 @@
<Tag>TXT_ACO_Unharmed</Tag>
<English>[NEWLINE]Unharmed:[SPACE]</English>
<French>[NEWLINE]Indemne:[SPACE]</French>
<German>[NEWLINE]Unverletzt:[SPACE]</German>
<German>[NEWLINE]Unversehrt:[SPACE]</German>
<Italian>[NEWLINE]Disarmato:[SPACE]</Italian>
<Spanish>[NEWLINE]Ileso:[SPACE]</Spanish>
</TEXT>
Expand All @@ -101,7 +101,7 @@
<Tag>TXT_ACO_TotalDefenseModifier</Tag>
<English>[NEWLINE]Total defense modifier:[SPACE]</English>
<French>[NEWLINE]Modificateur Total de defense:[SPACE]</French>
<German>[NEWLINE]Verteidigungsmodifikator gesamt:[SPACE]</German>
<German>[NEWLINE]Verteidigungsmodifikator absolut:[SPACE]</German>
<Italian>[NEWLINE]Modificatore difensivo totale:[SPACE]</Italian>
<Spanish>[NEWLINE]Modificador defensivo total:[SPACE]</Spanish>
</TEXT>
Expand All @@ -125,7 +125,7 @@
<Tag>TXT_ACO_GuaranteedNoDefenderHit</Tag>
<English>[NEWLINE][COLOR_HIGHLIGHT_TEXT]Guaranteed! Defender cannot score a hit.[COLOR_REVERT]</English>
<French>[NEWLINE][COLOR_HIGHLIGHT_TEXT]C'est garantie! L'unit&#233; d&#233;fensive ne peut marquer de coup.[COLOR_REVERT]</French>
<German>[NEWLINE][COLOR_HIGHLIGHT_TEXT]Sicher! Verteidiger wird keinen Treffer landen.[COLOR_REVERT]</German>
<German>[NEWLINE][COLOR_HIGHLIGHT_TEXT]Sicher! Der Verteidiger kann keinen Treffer landen.[COLOR_REVERT]</German>
<Italian>[NEWLINE][COLOR_HIGHLIGHT_TEXT]Certa! I difensori non possono colpire neppure una volta.[COLOR_REVERT]</Italian>
<Spanish>[NEWLINE][COLOR_HIGHLIGHT_TEXT]&#161;Garantizado! El defensor no puede dar en el blanco.[COLOR_REVERT]</Spanish>
</TEXT>
Expand Down
844 changes: 844 additions & 0 deletions Assets/XML/Text/External/BULL_CIV4GameText.xml

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions CvGameCoreDLL/Buffy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**********************************************************************
File: Buffy.h
Author: EmperorFool
Created: 2010-01-23
Defines common constants and functions for use throughout BUFFY.
Copyright (c) 2010 The BUG Mod. All rights reserved.
**********************************************************************/

#pragma once

#ifndef BUFFY_H
#define BUFFY_H

// name of the Python module where all the BUFFY functions that the DLL calls must live
// MUST BE A BUILT-IN MODULE IN THE ENTRYPOINTS FOLDER
// currently CvAppInterface
#define PYBuffyModule PYCivModule

// Increment this by 1 each time you commit new/changed functions in the Python API.
#define BUFFY_DLL_API_VERSION 1

// Used to signal the BULL saved game format is used
#define BUFFY_DLL_SAVE_FORMAT 64

// These are display-only values; the version and build should be changed for each release.
#define BUFFY_DLL_NAME L"BUFFY"
#define BUFFY_DLL_VERSION L"3.19.003"
#define BUFFY_DLL_BUILD L"100"

#endif
30 changes: 30 additions & 0 deletions CvGameCoreDLL/BugMod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**********************************************************************
File: BugMod.h
Author: EmperorFool
Created: 2009-01-22
Defines common constants and functions for use throughout the BUG Mod.
Copyright (c) 2009 The BUG Mod. All rights reserved.
**********************************************************************/

#pragma once

#ifndef BUG_MOD_H
#define BUG_MOD_H

// name of the Python module where all the BUG functions that the DLL calls must live
// MUST BE A BUILT-IN MODULE IN THE ENTRYPOINTS FOLDER
// currently CvAppInterface
#define PYBugModule PYCivModule

// Increment this by 1 each time you commit new/changed functions/constants in the Python API.
#define BUG_DLL_API_VERSION 4

// Used to signal the BULL saved game format is used
#define BUG_DLL_SAVE_FORMAT 64

// These are display-only values, and the version should be changed for each release.
#define BUG_DLL_NAME L"BULL"
#define BUG_DLL_VERSION L"1.2"
#define BUG_DLL_BUILD L"182"

#endif
1 change: 0 additions & 1 deletion CvGameCoreDLL/CvArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ CvArea::~CvArea()

void CvArea::init(int iID, bool bWater)
{
//GC.getGameINLINE().logMsg("area init", iID); //Rhye
//--------------------------------
// Init saved data
reset(iID, bWater);
Expand Down
121 changes: 121 additions & 0 deletions CvGameCoreDLL/CvBugOptions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/**********************************************************************
File: CvBugOptions.cpp
Author: EmperorFool
Created: 2009-01-21
Copyright (c) 2009 The BUG Mod. All rights reserved.
**********************************************************************/

// This file has been edited for K-Mod

#include "CvGameCoreDLL.h"
#include "CyArgsList.h"
#include "CvDLLPythonIFaceBase.h"
#include "FVariableSystem.h"

#include "CvBugOptions.h"

bool g_bIsBug = false;

void logMsg(const char *format, ...)
{
static char buf[2048];
_vsnprintf(buf, 2048 - 4, format, (char *)(&format + 1));
gDLL->logMsg("bull.log", buf);
}

bool isBug()
{
return g_bIsBug;
}

void setIsBug(bool bIsBug)
{
logMsg("isBug: %s", bIsBug ? "true" : "false");
g_bIsBug = bIsBug;
}

bool getDefineBOOL(const char *xmlKey, bool bDefault)
{
int iResult = 0;
if (GC.getDefinesVarSystem()->GetValue(xmlKey, iResult))
{
return iResult != 0;
}
else
{
return bDefault;
}
}

int getDefineINT(const char *xmlKey, int iDefault)
{
int iResult = 0;
if (GC.getDefinesVarSystem()->GetValue(xmlKey, iResult))
{
return iResult;
}
else
{
return iDefault;
}
}

bool getBugOptionBOOL(const char *id, bool bDefault, const char *xmlKey)
{
if (isBug())
{
CyArgsList argsList;
long lResult = 0;

argsList.add(id);
argsList.add(bDefault);

//logMsg("debug - getOptionBOOL(%s)", id);
gDLL->getPythonIFace()->callFunction(PYBugOptionsModule, "getOptionBOOL", argsList.makeFunctionArgs(), &lResult);
//logMsg("debug - got value %ld", lResult);

return lResult != 0;
}
else
{
CvString tmp;
if (!xmlKey)
{
tmp.append(OPTION_XML_PREFIX);
tmp.append(id);
xmlKey = tmp.c_str();
}
//logMsg("debug - getBugOptionBOOL %s", xmlKey);
return getDefineBOOL(xmlKey, bDefault);
}
}

int getBugOptionINT(const char *id, int iDefault, const char *xmlKey)
{
if (isBug())
{
CyArgsList argsList;
long lResult = 0;

argsList.add(id);
argsList.add(iDefault);

//logMsg("debug - getOptionBOOL(%s)", id);
gDLL->getPythonIFace()->callFunction(PYBugOptionsModule, "getOptionINT", argsList.makeFunctionArgs(), &lResult);
//logMsg("debug - got value %ld", lResult);

return lResult;
}
else
{
CvString tmp;
if (!xmlKey)
{
tmp.append(OPTION_XML_PREFIX);
tmp.append(id);
xmlKey = tmp.c_str();
}
//logMsg("debug - getBugOptionINT %s", xmlKey);
return getDefineINT(xmlKey, iDefault);
}
}
31 changes: 31 additions & 0 deletions CvGameCoreDLL/CvBugOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

/**********************************************************************
File: CvBugOptions.h
Author: EmperorFool
Created: 2009-01-21
Calls out to the CvAppInterface Python module to check user options.
Copyright (c) 2009 The BUG Mod. All rights reserved.
**********************************************************************/

#ifndef BUG_OPTIONS_H
#define BUG_OPTIONS_H

// Must use existing module because the DLL cannot see new modules in CustomAssets
#define PYBugOptionsModule PYCivModule

// Text prepended to option name if no XML key given
#define OPTION_XML_PREFIX "BULL__"

void logMsg(const char *format, ...);

bool isBug();
void setIsBug(bool bIsBug);

bool getDefineBOOL(const char *xmlKey, bool bDefault = false);
int getDefineINT(const char *xmlKey, int iDefault = 0);

bool getBugOptionBOOL(const char *id, bool bDefault = true, const char *xmlKey = NULL);
int getBugOptionINT(const char *id, int iDefault = 0, const char *xmlKey = NULL);

#endif
Loading

0 comments on commit 51532aa

Please sign in to comment.