Game Development Community

RW melee code crashing engine.....

by Josh Moore · in Torque Game Engine · 03/05/2004 (10:10 am) · 10 replies

I recently tried to add the Realm Wars melee code to my codebase. I added it all in, compiled with no errors. However when I loaded up a game, it just crashes(right after mission lighting).

I copied the code exactly in shapeBase.cc, shapeBase.h, player.cc, player.h, and in shapeImage.h. I think the code just isn't compatable. Has anyone else tried to use the RW melee code? I could really use a point in the right direction.

Edit: If you need me to post what I added, just say so.

#1
03/07/2004 (5:02 pm)
No reply......
#2
03/07/2004 (8:09 pm)
I added the RW melee code in a while ago and was able to get it to work...Do you have a stack trace of where it is crashing? It also needs a number of script (.cs) files to work correctly.

-Pascal
#3
03/11/2004 (2:17 pm)
I've figured out that UpdateImageRaycastDamage is causing the crash. I've tried to fiw the fuction but with no results. Does anyone see anything worng with this function?

void ShapeBase::UpdateImageRaycastDamage( F32 dt,U32 imageSlot)
{
   MountedImage& image = mMountedImageList[imageSlot];
   ShapeBaseImageData* imageData = image.dataBlock;
   
   if (!image.dataBlock) return;

    // test if our mount nodes are available.
   if (imageData->damageStartNode == -1) return;
   if (imageData->damageEndNode == -1) return;

   // temporarily say this is false so we get
   // the image transforms from the MOUNT points
   ShapeBaseImageData& data = *image.dataBlock;
   bool oldUse = data.useEyeOffset;
   data.useEyeOffset = false;

   // if we have our mount nodes, transform them to world space
   MatrixF startTrans;
   getImageTransform( imageSlot, imageData->damageStartNode, &startTrans );
   VectorF vecStart = startTrans.getPosition();
   MatrixF endTrans;
   getImageTransform( imageSlot, imageData->damageEndNode, &endTrans );
   VectorF vecEnd = endTrans.getPosition();

   // restore
   data.useEyeOffset = oldUse;


   // then call the raycast function in script to do the damage. lets call it onImageIntersect
   char buff1[32];
   char buff2[100];
   char buff3[100];

   dSprintf(buff1,sizeof(buff1),"%d",getShapeServerId());
   dSprintf(buff2,sizeof(buff2),"%f %f %f",vecStart.x, vecStart.y, vecStart.z);
   dSprintf(buff3,sizeof(buff3),"%f %f %f",vecEnd.x, vecEnd.y, vecEnd.z);

   // call the script function!
   Con::executef(image.dataBlock, 5, "onImageIntersect",scriptThis(),buff1,buff2,buff3);

}
#4
03/12/2004 (12:05 am)
The code looks fine.

I recently updated RW to torque Head and the code runs fine.

Could you post your error or assertion text?
This may help in tracking the problem down.

-- Markus
#5
03/12/2004 (9:35 am)
Thanks for the reply. When I use the trace function, the game freezes after "Entering SwordImage::onFire(82, 1569, 0)" It has something to do with this function and the way its called(or something like that). I'll post again when I have a bit more time. ;-)

Edit: I looked over my player.cc & .h, shapeBase.cc & h, and shapeImage.cc. All the editions in the RW files are in mine(except new console functions). If I get rid of this call in ShapeBase.cc, the animations will work but the collition call isn't there(no sword collitions). :-( I made a quick script function that searchs for a player directy in front and damages it, but its really crappy.
#6
03/16/2004 (12:49 pm)
I've checked and rechecked, that function is what freezes up the game. I've been able to get ingame with the collition call on, but when I mount a melee weapon the game freezes. I'm new to programing so I don't understand whats wrong with it(it compiles just fine). If anyone could help me out I would greatly appreciate it.

Thanks - The_Force

Edit: I got it working.
#7
03/18/2004 (8:41 am)
Care to share, Josh?
#8
03/18/2004 (4:03 pm)
Sure, I'll submit it as a resource. I'll post here with a link when its up.
#9
03/19/2004 (12:02 am)
Excellent, thanx.
#10
03/19/2004 (8:53 pm)
Ok, its up, but the download isn't, you'll have to wait untill its is. I'm planing on adding shield and sword rebounding to the tut, but I have to wait too.

Edit: Heres the link: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5377