bool FireWeapon(void){ ACTOR *newshot; newshot = new ACTOR; newshot->worldPos = player->worldPos; //get players position newshot->rot = player->rot; //get players rotation newshot->rightVector = player->rightVector; //get players right hand vector newshot->upVector = player->upVector; //get players up hand vector newshot->rotation = player->rotation; //get players rotation stored as QUATERNION newshot->directionVector = player->directionVector; //get players foward vector switch(player->typeshot) { case SHOT1: newshot->type = Weapon1.type; //Set the actor type newshot->typeshot = Weapon1.typeshot; //Set the shot type newshot->active = Weapon1.active; //Activate the actor newshot->radius = Weapon1.radius; //Set the actors radius newshot->mass = Weapon1.mass; //Calculate the actors mass newshot->normalMaxVelocity = Weapon1.normalMaxVelocity; newshot->currentMaxVelocity = Weapon1.currentMaxVelocity; //Setup the max velocities newshot->forward = Weapon1.forward; newshot->damage = Weapon1.damage; newshot->lifeTime = Weapon1.lifeTime; newshot->rechargeTime = Weapon1.rechargeTime; break; case SHOT2: newshot->type = Weapon2.type; //Set the actor type newshot->typeshot = Weapon2.typeshot; //Set the shot type newshot->active = Weapon2.active; //Activate the actor newshot->radius = Weapon2.radius; //Set the actors radius newshot->mass = Weapon2.mass; //Calculate the actors mass newshot->normalMaxVelocity = Weapon2.normalMaxVelocity; newshot->currentMaxVelocity = Weapon2.currentMaxVelocity; //Setup the max velocities newshot->forward = Weapon2.forward; newshot->damage = Weapon2.damage; newshot->lifeTime = Weapon2.lifeTime; newshot->rechargeTime = Weapon2.rechargeTime; break; default: break; } ShotList.Append(newshot); return true;}
Everything in stored in classes. This bit is called when the player presses the fire key on the keyboard. Weapon1 and Weapon2 are predefined elsewhere in the program. This bit just takes data from the player and sets up the location. Then depending on the weapon fired, takes and copies data from the predefined weapon. After all this is done, it places the data into a linked list that I have written to I can access and manipulate the data. This is where I need to move the shot to the gunport.
I tried using the glPushMatrix and glPopMatrix but it doesn''t seem to work in this portion of the program. I know I am missing something but I can''t figure out what.