Skip to content

Commit

Permalink
Release: bugfixes, 3d, M2TWEOP-2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
youneuoy committed Mar 20, 2023
1 parent 3682d28 commit f78ce69
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 9 deletions.
2 changes: 1 addition & 1 deletion M2TWEOP Code/M2TWEOP Common/m2tweopConstData.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
namespace eopConstData
{
const char eopVersionName[] = "M2TWEOP-2.1.39";
const char eopVersionName[] = "M2TWEOP-2.2.0";
}
33 changes: 26 additions & 7 deletions M2TWEOP Code/M2TWEOP library/MapTextDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ namespace MapTextDrawer
auto device = graphicsExport::GetDevice();

D3DXMATRIX matRotate;
float xR = D3DXToRadian(1);
float yR = D3DXToRadian(90);
float zR = D3DXToRadian(1);
float xR = D3DXToRadian(text->xRoll);
float yR = D3DXToRadian(text->yRoll);
float zR = D3DXToRadian(text->zRoll);
D3DXMatrixRotationYawPitchRoll(&matRotate, xR, yR, zR);

D3DXMATRIX matScale;

float scalex = 1;
float scaley = 0.2;
float scalez = 1;
D3DXMatrixScaling(&matScale, scalex, scaley, scalez);
D3DXMatrixScaling(&matScale, text->xSize, text->ySize, text->zSize);



Expand Down Expand Up @@ -176,6 +173,28 @@ namespace MapTextDrawer

TextMesh->UnlockVertexBuffer();
}
NOINLINE EOP_EXPORT void SetDimensionsTextXYZ(Text3DDrawable* text, float scaleX, float scaleY, float scaleZ)
{
if (text == nullptr)
{
return;
}

text->xSize = scaleX;
text->ySize = scaleY;
text->zSize = scaleZ;
}
NOINLINE EOP_EXPORT void SetRotationTextXYZ(Text3DDrawable* text, float rotX, float rotY, float rotZ)
{
if (text == nullptr)
{
return;
}

text->xRoll = rotX;
text->xRoll = rotY;
text->zRoll = rotZ;
}
NOINLINE EOP_EXPORT void ChangeTextColor(Text3DDrawable* text, unsigned char a, unsigned char r, unsigned char g, unsigned char b)
{
if (text == nullptr)
Expand Down
8 changes: 8 additions & 0 deletions M2TWEOP Code/M2TWEOP library/MapTextDrawer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace MapTextDrawer
float xCoord;
float yCoord;
float zCoord;
float xSize=1;
float ySize=0.2;
float zSize=1;
float xRoll=1;
float yRoll=90;
float zRoll=1;
bool isDrawOnce;
bool isDeleteNeeded;
};
Expand All @@ -26,6 +32,8 @@ namespace MapTextDrawer
NOINLINE EOP_EXPORT void Delete3dText(Text3DDrawable*text);

NOINLINE EOP_EXPORT void ScaleText(Text3DDrawable* text,float scale);
NOINLINE EOP_EXPORT void SetDimensionsTextXYZ(Text3DDrawable* text,float scaleX, float scaleY, float scaleZ);
NOINLINE EOP_EXPORT void SetRotationTextXYZ(Text3DDrawable* text,float rotX, float rotY, float rotZ);
NOINLINE EOP_EXPORT void ChangeTextColor(Text3DDrawable* text, unsigned char a, unsigned char r, unsigned char g, unsigned char b);


Expand Down
2 changes: 1 addition & 1 deletion M2TWEOP Code/M2TWEOP library/stratModelsChange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace stratModelsChange
}

crashFixAr.emplace_back(changeMod->x, changeMod->y, listFac[i], vis);
fastFuncts::setTileVisibility(listFac[i], changeMod->x, changeMod->y, 1);
fastFuncts::setTileVisibility(listFac[i], changeMod->x, changeMod->y, 0);
}

}
Expand Down
2 changes: 2 additions & 0 deletions M2TWEOP-luaPlugin/luaPlugin/basicFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class basicFuncs
ProcLoader<void(__cdecl*)(Text3DDrawable* text)> StopDrawingText;
ProcLoader<void(__cdecl*)(Text3DDrawable* text)> DrawingTextOnce;
ProcLoader<void(__cdecl*)(Text3DDrawable* text)> Delete3dText;
ProcLoader<void(__cdecl*)(Text3DDrawable* text, float scaleX, float scaleY, float scaleZ)> SetDimensionsTextXYZ;
ProcLoader<void(__cdecl*)(Text3DDrawable* text, float rotX, float rotY, float rotZ)> SetRotationTextXYZ;


ProcLoader<void(__cdecl*)(const char*, UINT32)> addModelToGame;
Expand Down
6 changes: 6 additions & 0 deletions M2TWEOP-luaPlugin/luaPlugin/eopMasterTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ struct Text3DDrawable
float xCoord;
float yCoord;
float zCoord;
float xSize = 1;
float ySize = 1;
float zSize = 1;
float xRoll = 1;
float yRoll = 90;
float zRoll = 1;
bool isDrawOnce;
bool isDeleteNeeded;
};
21 changes: 21 additions & 0 deletions M2TWEOP-luaPlugin/luaPlugin/luaEop3dObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ void luaP::initEop3dObjects()

/***
3d text object. Not use it onPluginLoad(graphics system not initialized here yet).
@tfield float xSize default value 1
@tfield float ySize default value 0.2
@tfield float zSize default value 1
@tfield float xRoll default value 1
@tfield float yRoll default value 90
@tfield float zRoll default value 1
@tfield float xCoord
@tfield float yCoord
@tfield float zCoord
@tfield Scale Scale
@tfield ChangeColor ChangeColor
@tfield SetCoords SetCoords
Expand All @@ -87,6 +96,17 @@ void luaP::initEop3dObjects()

tables.text3dDrawable = luaState.new_usertype<Text3DDrawable>("Eop3dText");

tables.text3dDrawable.set("xSize", &Text3DDrawable::xSize);
tables.text3dDrawable.set("ySize", &Text3DDrawable::ySize);
tables.text3dDrawable.set("zSize", &Text3DDrawable::zSize);

tables.text3dDrawable.set("xRoll", &Text3DDrawable::xRoll);
tables.text3dDrawable.set("yRoll", &Text3DDrawable::yRoll);
tables.text3dDrawable.set("zRoll", &Text3DDrawable::zRoll);

tables.text3dDrawable.set("xCoord", &Text3DDrawable::xCoord);
tables.text3dDrawable.set("yCoord", &Text3DDrawable::yCoord);
tables.text3dDrawable.set("zCoord", &Text3DDrawable::zCoord);
/***
Scale 3d text.
@function Eop3dText:Scale
Expand All @@ -97,6 +117,7 @@ void luaP::initEop3dObjects()
newText:Scale(0.3);
*/
tables.text3dDrawable.set_function("Scale", &eop3dObjectsHelpers::ScaleText);

/***
Set 3d text color.
@function Eop3dText:ChangeColor
Expand Down
4 changes: 4 additions & 0 deletions M2TWEOP-luaPlugin/luaPlugin/pluginM2TWEOP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ int initPlugin(std::string* modPath)
plugData::data.funcs.StopDrawingText.Load(&plPath, &fName);
fName = "DrawingTextOnce";
plugData::data.funcs.DrawingTextOnce.Load(&plPath, &fName);
fName = "SetDimensionsTextXYZ";
plugData::data.funcs.SetDimensionsTextXYZ.Load(&plPath, &fName);
fName = "SetRotationTextXYZ";
plugData::data.funcs.SetRotationTextXYZ.Load(&plPath, &fName);

fName = "addModelToGame";
plugData::data.funcs.addModelToGame.Load(&plPath, &fName);
Expand Down

0 comments on commit f78ce69

Please sign in to comment.