Kaynağa Gözat

Fixed screen entities not being set correctly in 2d collision responses after recent pull request, added support for shorts in the bindings

Ivan Safrin 13 yıl önce
ebeveyn
işleme
1d7db8ed64

+ 1 - 0
Bindings/Scripts/create_lua_library/create_lua_library.py

@@ -53,6 +53,7 @@ def typeFilter(ty):
 	ty = ty.replace("&", "")
 	ty = ty.replace("&", "")
 	ty = re.sub(r'^.*\sint\s*$', 'int', ty) # eg "unsigned int"
 	ty = re.sub(r'^.*\sint\s*$', 'int', ty) # eg "unsigned int"
 	ty = re.sub(r'^.*\slong\s*$', 'int', ty)
 	ty = re.sub(r'^.*\slong\s*$', 'int', ty)
+	ty = re.sub(r'^.*\sshort\s*$', 'int', ty)
 	ty = re.sub(r'^.*\sfloat\s*$', 'Number', ty)
 	ty = re.sub(r'^.*\sfloat\s*$', 'Number', ty)
 	ty = re.sub(r'^.*\sdouble\s*$', 'Number', ty) # eg "long double"
 	ty = re.sub(r'^.*\sdouble\s*$', 'Number', ty) # eg "long double"
 	ty = ty.replace("unsigned", "int")
 	ty = ty.replace("unsigned", "int")

+ 6 - 6
Modules/Contents/2DPhysics/Source/PolyPhysicsScreen.cpp

@@ -57,8 +57,8 @@ void PhysicsScreen::BeginContact (b2Contact *contact) {
 //		return;
 //		return;
 //	}
 //	}
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = (ScreenEntity*)contact->GetFixtureA()->GetUserData();
-	newEvent->entity2 = (ScreenEntity*)contact->GetFixtureB()->GetUserData();			
+	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
+	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
 
 
     if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
     if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
         ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
         ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->collisionOnly) {
@@ -97,8 +97,8 @@ void PhysicsScreen::BeginContact (b2Contact *contact) {
 
 
 void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) {
 void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) {
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = (ScreenEntity*)contact->GetFixtureA()->GetUserData();
-	newEvent->entity2 = (ScreenEntity*)contact->GetFixtureB()->GetUserData();		
+	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
+	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
 
 
     
     
     if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
     if(((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->collisionOnly ||
@@ -143,8 +143,8 @@ void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impuls
 
 
 void PhysicsScreen::EndContact (b2Contact *contact) {
 void PhysicsScreen::EndContact (b2Contact *contact) {
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
 	PhysicsScreenEvent *newEvent = new PhysicsScreenEvent();
-	newEvent->entity1 = (ScreenEntity*)contact->GetFixtureA()->GetUserData();
-	newEvent->entity2 = (ScreenEntity*)contact->GetFixtureB()->GetUserData();	
+	newEvent->entity1 = ((PhysicsScreenEntity*)contact->GetFixtureA()->GetBody()->GetUserData())->getScreenEntity();
+	newEvent->entity2 = ((PhysicsScreenEntity*)contact->GetFixtureB()->GetBody()->GetUserData())->getScreenEntity();
     newEvent->contact = contact;
     newEvent->contact = contact;
     
     
 	for(int i=0; i < contacts.size(); i++) {
 	for(int i=0; i < contacts.size(); i++) {