Jump to content

Yack Pack 3.8 merge with errors


Recommended Posts

*Updated Subject for clarification*


Hi all. I had Yack Pack working in 3.6.1 and now I'm having some trouble with 3.8. Below is the merge guide I created for 3.6.1 and used for 3.8 (*note: only changed code snippets are shown. You still need to own Yack Pack and have access to it's merge guide.)


First, here are some helpful references that I used:

TDN: http://tdn.garagegames.com/wiki/TorqueShaderEngine/Yack_Pack_TGEA_1_7

Resource: http://www.garagegames.com/community/resource/view/19541/1

Forums: http://www.garagegames.com/community/forums/viewthread/100823/1


And here is the current Visual Studio error I'm getting when trying to compile with 3.8. I think it has something to do with "console.h". A lot has changed in that file since 3.6 and "dialogMemory.cpp" has that as an #include. Any tips on what I need to change?


error C2440: 'type cast' : cannot convert from 'ConsoleValueRef' to 'char *' dialogMemory.cpp 120

error C2440: 'type cast' : cannot convert from 'ConsoleValueRef' to 'char *' dialogMemory.cpp 125


dilaogMemory.cpp code that the errors are referring to:

ConsoleMethod(DialogMemory, addPhrase, void, 3, 3, "phrase")
{
	object->addPhrase((char*)argv[2]);
}
 
ConsoleMethod(DialogMemory, hasPhrase, bool, 3, 3, "phrase")
{
	return object->hasPhrase((char*)argv[2]);
}

 


And now for the 3.6.1 merge changes:


Change the following in dialogMemory.cpp:

change #include "core/bitStream.h" to #include "core/stream/bitStream.h"

change #include "game/gameConnection.h" to #include "T3D/gameBase/gameConnection.h"

change #include "game/dialogMemory.h" to #include "T3D/dialogMemory.h"

change bool DialogMemory::onNewDataBlock(GameBaseData* dptr) to bool DialogMemory::onNewDataBlock(GameBaseData* dptr, bool reload)

change if (!mDataBlock || !Parent::onNewDataBlock(dptr)) to if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload))


Change the following in dialogMemory.h:

change #include "game/gameConnection.h" to #include "T3D/gameBase/gameConnection.h"

change #include "core/tVector.h" to #include "core/util/tVector.h"

change #include "game/gameBase.h" to #include "T3D/gameBase/gameBase.h"

change bool onNewDataBlock(GameBaseData* dptr); to bool onNewDataBlock(GameBaseData* dptr, bool reload);


Follow the official Yack Pack Merge Guide with the noted changes:


Step 1) engine/source/T3D/player.h

1. Insert: replace #include "game/dialogMemory.h" with #include "T3D/dialogMemory.h"

2. Insert: same as merge guide

3. Insert: same as merge guide


Step 2) engine/source/T3D/player.cpp

1. Insert: same as merge guide

2. Insert: same as merge guide

3. Insert: same as merge guide

4. Insert: same as merge guide


Step 3) engine/source/T3D/shapeBase.h

1. Insert: Place after the following bool mTrigger[MaxTriggerKeys]; ///< What triggers are set, if any.

2. Insert: comment out static void initPersistFields();


Step 4) engine/source/T3D/shapeBase.cpp

1. Replace: Not necessary, sAudioTimeout is already set to 500

2. Insert: Place after the following mWeaponCamShake = NULL; (instead of damageDir.set(0, 0, 1);)

3. Insert: same as merge guide

4. Insert: same as merge guide

5. Insert: Place after the following “Parent::initPersistFields();” (in the void ShapeBase::initPersistFields() function)

//START YACK
addField("enableUse", TypeBool, Offset(mEnableUse, ShapeBase));
//END YACK

Then insert the following at the end of the file:

//START YACK
ConsoleMethod( ShapeBase, enableUse, void, 3, 3, "bool")
{
	object->enableUse(dAtob(argv[2]));
}
 
ConsoleMethod( ShapeBase, isUseEnabled, bool, 2, 2, "")
{
	return object->isUseEnabled();
}
//END YACK

 

Step 5) engine/source/T3D/fps/guiCrossHairHud.cpp

1. Insert: same as merge guide

2. Insert: same as merge guide

3. Insert: same as merge guide

4. Insert: same as merge guide

5. Replace: same as merge guide

6. Replace: same as merge guide

7. Insert: same as merge guide

8. Insert: same as merge guide

9. Insert: replace Con::executef(this, 1, "onRender"); with Con::executef(this, "onRender");

10. Insert: same as merge guide


Step 6) engine/source/gui/utility/guiInputCtrl.h

1. Insert: place after the following: typedef GuiMouseEventCtrl Parent;

2. Insert: place the following after DECLARE_CONOBJECT(GuiInputCtrl);

//START YACK
GuiInputCtrl();
//END YACK

 

Step 7) engine/source/gui/utility/guiInputCtrl.cpp

1. Insert: same as merge guide

2. Insert: place after the following IMPLEMENT_CONOBJECT(GuiInputCtrl);

//START YACK
GuiInputCtrl::GuiInputCtrl()
{
    mAutoGrabInput = true;
}
//END YACK

Then place after the following Parent::initPersistFields(); (in the void GuiInputCtrl::initPersistFields() function)

//START YACK
addField("autoGrabInput", TypeBool, Offset(mAutoGrabInput, GuiInputCtrl));
//END YACK

3. Replace: same as merge guide

4. Replace: same as merge guide


Step 8) engine/source/gui/controls/guiTextListCtrl.h

1. Insert: same as merge guide

2. Insert: same as merge guide

3. Insert: same as merge guide


Step 9) engine/source/gui/controls/guiTextListCtrl.cpp

1. Insert: same as merge guide

2. Insert: same as merge guide

3. Replace: the entire GuiTextListCtrl::onRenderCell function with:

void GuiTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver)
{
   if ( mList[cell.y].active )
   {
      if (selected || (mProfile->mMouseOverSelected && mouseOver))
      {
         RectI highlightRect = RectI(offset.x, offset.y, mCellSize.x, mCellSize.y);
         highlightRect.inset( 0, -1 );
         renderFilledBorder( highlightRect, mProfile->mBorderColorHL, mProfile->mFillColorHL);
         GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColorHL);
      }
      else
         GFX->getDrawUtil()->setBitmapModulation(mouseOver ? mProfile->mFontColorHL : mProfile->mFontColor);
   }
   else
      GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColorNA );
 
   const char *text = mList[cell.y].text;
   for(U32 index = 0; index < mColumnOffsets.size(); index++)
   {
      const char *nextCol = dStrchr(text, '\t');
      if(mColumnOffsets[index] >= 0)
      {
         dsize_t slen;
         if(nextCol)
            slen = nextCol - text;
         else
            slen = dStrlen(text);
 
         Point2I pos(offset.x + 4 + mColumnOffsets[index], offset.y);
 
         RectI saveClipRect;
         bool clipped = false;
 
         if(mClipColumnText && (index != (mColumnOffsets.size() - 1)))
         {
            saveClipRect = GFX->getClipRect();
 
            RectI clipRect(pos, Point2I(mColumnOffsets[index+1] - mColumnOffsets[index] - 4, mCellSize.y));
            if(clipRect.intersect(saveClipRect))
            {
               clipped = true;
               GFX->setClipRect( clipRect );
            }
         }
 
         GFX->getDrawUtil()->drawTextN(mFont, pos, text, slen, mProfile->mFontColors);
 
         if(clipped)
            GFX->setClipRect( saveClipRect );
      }
      if(!nextCol)
         break;
      text = nextCol+1;
   }
}

4. Insert: same as merge guide

5. Insert: same as merge guide

6. Insert: same as merge guide

7. Insert: same as merge guide

Edited by SqHd
Link to post
Share on other sites

Step 10) game/scripts/client/default.cs

1. Insert: same as merge guide


Step 11) game/scripts/client/init.cs

1. Insert: the following after the client scripts section:

//Yack scripts
exec("scripts/gui/yackGui.cs");
exec("scripts/gui/guiCrossHairHud.cs");
exec("scripts/gui/yackProfiles.cs");
exec("art/gui/YackGui.gui");
//END YACK

 

Step 12) game/scripts/server/default.cs

1. Insert: same as merge guide


Step 13) game/art/datablocks/aiPlayer.cs

1. Insert: the following after shootingDelay = 2000;

//START YACK
canTalk = true;
dialogScriptName = "Stanley_Sunshine_Dialogue";
dialogScriptFile = "scripts/server/dialogue/Stanley_Sunshine.dls";
dialogImg = "art/yack/Kork_Portrait.png";
name = "SquareHead";
//END YACK

 

Step 14) game/art/datablocks/audioProfiles.cs

1. Insert: the following:

//START YACK
datablock SFXDescription(DialogSound : AudioClosest3D)
{
volume   = 1.2;
isLooping= false;
is3D     = true;
ReferenceDistance= 10.0;
MaxDistance= 30.0;
type     = $SimAudioType;
};
//END YACK

2. Insert: the following into game/scripts/server/scriptExec.cs (at the end):

//START YACK
exec("./dialogue/Stanley_Sunshine.dla");
//END YACK

 

Step 15) game/scripts/server/scriptExec.cs

1. Insert: same as merge guide

2. Insert: same as merge guide, but in this file game/scripts/server/gameCore.cs

3. Insert: place after the following %player.setShapeName(%client.playerName); but in this file game/scripts/server/gameCore.cs


Step 16) game/scripts/client/default.bind.cs

1. Insert: same as merge guide


Step 17) game/art/gui/playGui.gui

1. Insert: the following after new GuiCrossHairHud(ZoomReticle)

new GuiCrossHairHud(Crosshair) {
damageFillColor = "0 1 0 1";
damageFrameColor = "1 0.6 0 1";
damageRect = "50 4";
damageOffset = "0 10";
interactDist = "10";
bitmap = "art/gui/crossHair_talk.png";
wrap = "0";
position = "496 368";
extent = "32 32";
minExtent = "8 8";
horizSizing = "center";
vertSizing = "center";
profile = "GuiModelessDialogProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};

2. Insert: the following at the end before the last bracket:

new GuiTextCtrl(NpcName) {
text = "DemoPlayer";
maxLength = "1024";
docking = "None";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "20 448";
extent = "175 23";
minExtent = "8 8";
horizSizing = "relative";
vertSizing = "relative";
profile = "YackNameProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
Link to post
Share on other sites

File Placement:


Place in game/art/gui/

1. black.png

(I had to make a new 'black.png'. I made it 64 x 64 pixels because the 1 x 1 pixel version wasn't working. Before I did this, there were just white bars showing up at the top and bottom of the screen instead of the black ones.)

2. crossHair_talk.png

3. YackGui.gui


Place in game/art/

1. Yack (folder with the 2 .png portraits and all the .ogg sound files)


Place in game/scripts/gui/

1. yackGui.cs

2. yackProfiles.cs – replace the following:

“new GuiControlProfile” with “singleton GuiControlProfile”

“(YackTextListProfile: GuiTextListProfile)” with “(YackTextListProfile: GuiTextProfile)”

3. guiCrossHairHud.cs (change the following):

change %this.setBitmap("starter.fps/client/ui/crossHair_talk.png"); to %this.setBitmap("art/gui/crossHair_talk.png");

change %this.setBitmap("starter.fps/client/ui/crossHair.png"); to %this.setBitmap("art/gui/weaponHud/crossHair.png");

change %this.setBitmap("starter.fps/client/ui/crossHair.png"); to %this.setBitmap("art/gui/weaponHud/crossHair.png");


Place in game/scripts/server/

1. yack.cs

2. dialogue (folder with the Stanley_Sunshine.dla and Stanley_Sunshine.dls files)

Stanley_Sunshine.dla (Replace “AudioProfile” with “SFXProfile”)

Stanley_Sunshine.dla (Replace “~/data/shapes/player/” with “art/yack/”)

Link to post
Share on other sites

Build Warning:

This is due to the 3rd insert from step 7 from the merge guide:

Warning 31 warning C4715: 'GuiInputCtrl::onWake' : not all control paths return a value guiinputctrl.cpp 107


Console Errors:

Debug (32 bit):

scripts/gui/yackGui.cs (104): Unable to find object: '0' attempting to call function 'hasPhrase'

scripts/gui/yackGui.cs (68): Unable to find function alxIsPlaying


Release (32 bit):

scripts/gui/yackGui.cs (104): Unable to find object: '0' attempting to call function 'hasPhrase'

(Need to do further experimentation – make sure to use the correct AI from UAISK – defaultplayer)

??????scripts/server/yack.cs (262): Unknown command addPhrase.

???? Object (4287) Camera -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject

????? We've blocked so end this sucker

??????Mapping string: YackEnd to index: 21

scripts/gui/yackGui.cs (68): Unable to find function alxIsPlaying


Glitches:

1. When speaking to an NPC, there is a quick twitch as the player centers on the NPC.

(This may have something to do with the centerHead and facePlayer code in player.cpp and player.h.)

2. NPC name is off to the left side

3. Audio will continue to play after a mouse click (unless another phrase was selected)


Feature Wish List:

1. Ability for NPCs to stop and talk (when on a path) and to return to the path afterwards

2. Ability for NPCs to return to idle animations

Link to post
Share on other sites

Folks transitioned to a cleaner system a while back for most of that stuff: https://github.com/GarageGames/Torque3D/blob/7bba3ee2de610c2757bc70eba10db869bab72a85/Engine/source/console/engineAPI.h#L2729


***do note, haven't gotten around to PRing over a doc-fix. that " ( "value for s" )" bit should more read "default for f, default for s)") or something along those lines since a) it don't read things backjwards, and b) well, it's the default if you don't pass the method a variable.


edit: also, we has community editable wiki http://torque3d.wikidot.com/ nao :D

Link to post
Share on other sites

to use https://github.com/GarageGames/Torque3D/blob/7bba3ee2de610c2757bc70eba10db869bab72a85/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp#L95 as a template example,

 

ConsoleMethod(DialogMemory, addPhrase, void, 3, 3, "phrase")
{
   object->addPhrase((char*)argv[2]);
}

ConsoleMethod(DialogMemory, hasPhrase, bool, 3, 3, "phrase")
{
   return object->hasPhrase((char*)argv[2]);
}

 

becomes



DefineConsoleMethod( DialogMemory, addPhrase, void, ( const char * phrase ),(""), "Add phrase to the dialogue")
{
   object->addPhrase(phrase);

}
DefineConsoleMethod( DialogMemory, hasPhrase, bool, ( const char * phrase ),(""), "Does the dialogue contain this passed phrase?")
{
  return object->hasPhrase(phrase);
}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...