void btGImpactCollisionAlgorithm::gimpact_vs_compoundshape( btDispatcher* dispatcher, const btCollider* body0, const btCollider* body1, const btGImpactShapeInterface* shape0, const btCompoundShape* shape1, bool swapped ) { btTransform orgtrans1 = body1->getWorldTransform(); int i = shape1->getNumChildShapes(); while(i--) { const btCollisionShape* colshape1 = shape1->getChildShape(i); btTransform childtrans1 = orgtrans1 * shape1->getChildTransform(i); btCollider new1(body1, colshape1, body1->getCollisionObject(), childtrans1); //collide child shape gimpact_vs_shape( dispatcher, body0, &new1, shape0, colshape1, swapped ); } }
void btGImpactCollisionAlgorithm::shape_vs_shape_collision( btDispatcher* dispatcher, const btCollider* body0, const btCollider* body1, const btCollisionShape* shape0, const btCollisionShape* shape1 ) { const btCollisionShape* tmpShape0 = body0->getCollisionShape(); const btCollisionShape* tmpShape1 = body1->getCollisionShape(); btCollider new0(body0, tmpShape0, body0->getCollisionObject(), body0->getWorldTransform()); btCollider new1(body1, tmpShape1, body1->getCollisionObject(), body1->getWorldTransform()); { btCollisionAlgorithm* algor = newAlgorithm(dispatcher, body0, body1); // post : checkManifold is called m_resultOut->setShapeIdentifiersA(m_part0,m_triface0); m_resultOut->setShapeIdentifiersB(m_part1,m_triface1); btCollisionProcessInfo processInfo(new0, new1, *m_dispatchInfo, m_resultOut, dispatcher); algor->processCollision(processInfo); algor->nihilize(dispatcher); algor->~btCollisionAlgorithm(); dispatcher->freeCollisionAlgorithm(algor); } }
void btGImpactCollisionAlgorithm::convex_vs_convex_collision( btDispatcher* dispatcher, const btCollider* body0, const btCollider* body1, const btCollisionShape* shape0, const btCollisionShape* shape1 ) { const btCollisionShape* tmpShape0 = body0->getCollisionShape(); const btCollisionShape* tmpShape1 = body1->getCollisionShape(); btCollider new0(body0, tmpShape0, body0->getCollisionObject(), body0->getWorldTransform()); btCollider new1(body1, tmpShape1, body1->getCollisionObject(), body1->getWorldTransform()); m_resultOut->setShapeIdentifiersA(m_part0,m_triface0); m_resultOut->setShapeIdentifiersB(m_part1,m_triface1); btCollisionProcessInfo processInfo(new0, new1, *m_dispatchInfo, m_resultOut, dispatcher); checkConvexAlgorithm(dispatcher, &new0, &new1); m_convex_algorithm->processCollision(processInfo); }
/* * calculate addressability as follows * REGISTER ==> 12 register * NAME ==> 11 name+value(SB/SP) * note that 10 is no longer generated * CONST ==> 20 $value * *(20) ==> 21 value * &(10) ==> 12 $name+value(SB) * &(11) ==> 1 $name+value(SP) * (12) + (20) ==> 12 fold constants * (1) + (20) ==> 1 fold constants * *(12) ==> 10 back to name * *(1) ==> 11 back to name * * (2,10,11) + (20) ==> 2 indirect w offset * (2) ==> &13 * *(10,11) ==> 13 indirect, no index * * (20) * (X) ==> 7 multiplier in indexing * (X,7) + (12,1) ==> 8 adder in indexing (addresses) * (X,7) + (10,11,2) ==> 8 adder in indexing (names) * (8) ==> &9 index, almost addressable * * (X)++ ==> X fake addressability * * calculate complexity (number of registers) */ void xcom(Node *n) { Node *l, *r; int g; if(n == Z) return; l = n->left; r = n->right; n->complex = 0; n->addable = 0; switch(n->op) { case OCONST: n->addable = 20; break; case ONAME: n->addable = 11; /* difference to make relocatable */ break; case OREGISTER: n->addable = 12; break; case OADDR: xcom(l); if(l->addable == 10) n->addable = 12; else if(l->addable == 11) n->addable = 1; break; case OADD: xcom(l); xcom(r); if(n->type->etype != TIND) break; if(l->addable == 20) switch(r->addable) { case 12: case 1: n->addable = r->addable; goto brk; } if(r->addable == 20) switch(l->addable) { case 12: case 1: n->addable = l->addable; goto brk; } break; case OIND: xcom(l); if(l->op == OADDR) { l = l->left; l->type = n->type; *n = *l; return; } switch(l->addable) { case 20: n->addable = 21; break; case 1: n->addable = 11; break; case 12: n->addable = 10; break; } break; case OASHL: xcom(l); xcom(r); if(typev[n->type->etype]) break; g = vconst(r); if(g >= 0 && g < 4) n->addable = 7; break; case OMUL: case OLMUL: xcom(l); xcom(r); if(typev[n->type->etype]) break; g = vlog(r); if(g >= 0) { n->op = OASHL; r->vconst = g; if(g < 4) n->addable = 7; break; } g = vlog(l); if(g >= 0) { n->left = r; n->right = l; l = r; r = n->right; n->op = OASHL; r->vconst = g; if(g < 4) n->addable = 7; break; } break; case ODIV: case OLDIV: xcom(l); xcom(r); if(typev[n->type->etype]) break; g = vlog(r); if(g >= 0) { if(n->op == ODIV) n->op = OASHR; else n->op = OLSHR; r->vconst = g; } break; case OSUB: xcom(l); xcom(r); if(typev[n->type->etype]) break; if(vconst(l) == 0) { n->op = ONEG; n->left = r; n->right = Z; } break; case OXOR: xcom(l); xcom(r); if(typev[n->type->etype]) break; if(vconst(l) == -1) { n->op = OCOM; n->left = r; n->right = Z; } break; case OASMUL: case OASLMUL: xcom(l); xcom(r); if(typev[n->type->etype]) break; g = vlog(r); if(g >= 0) { n->op = OASASHL; r->vconst = g; } goto aseae; case OASDIV: case OASLDIV: xcom(l); xcom(r); if(typev[n->type->etype]) break; g = vlog(r); if(g >= 0) { if(n->op == OASDIV) n->op = OASASHR; else n->op = OASLSHR; r->vconst = g; } goto aseae; case OASLMOD: case OASMOD: xcom(l); xcom(r); if(typev[n->type->etype]) break; aseae: /* hack that there are no byte/short mul/div operators */ if(n->type->etype == TCHAR || n->type->etype == TSHORT) { n->right = new1(OCAST, n->right, Z); n->right->type = types[TLONG]; n->type = types[TLONG]; } if(n->type->etype == TUCHAR || n->type->etype == TUSHORT) { n->right = new1(OCAST, n->right, Z); n->right->type = types[TULONG]; n->type = types[TULONG]; } goto asop; case OASXOR: case OASOR: case OASADD: case OASSUB: case OASLSHR: case OASASHR: case OASASHL: case OASAND: case OAS: xcom(l); xcom(r); if(typev[n->type->etype]) break; asop: if(l->addable > INDEXED && l->complex < FNX && r && r->complex < FNX) n->addable = l->addable; break; case OPOSTINC: case OPREINC: case OPOSTDEC: case OPREDEC: xcom(l); if(typev[n->type->etype]) break; if(l->addable > INDEXED && l->complex < FNX) n->addable = l->addable; break; default: if(l != Z) xcom(l); if(r != Z) xcom(r); break; } brk: n->complex = 0; if(n->addable >= 10) return; if(l != Z) n->complex = l->complex; if(r != Z) { if(r->complex == n->complex) n->complex = r->complex+1; else if(r->complex > n->complex) n->complex = r->complex; } if(n->complex == 0) n->complex++; if(com64(n)) return; switch(n->op) { case OFUNC: n->complex = FNX; break; case OADD: case OMUL: case OLMUL: case OXOR: case OAND: case OOR: /* * symmetric operators, make right side simple * if same, put constant on left to get movq */ if(r->complex > l->complex || (r->complex == l->complex && r->addable == 20)) { n->left = r; n->right = l; } break; case OLE: case OLT: case OGE: case OGT: case OEQ: case ONE: /* * relational operators, make right side simple * if same, put constant on left to get movq */ if(r->complex > l->complex || r->addable == 20) { n->left = r; n->right = l; n->op = invrel[relindex(n->op)]; } break; } }
void shakil::first() { tm=0; showmouseptr(); while(1) { getmousepos(&button,&x,&y); if(tm==0) { hidemouseptr(); setcolor(7); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,7); floodfill(110,110,7); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,7); floodfill(110,170,7); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,7); floodfill(110,220,7); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,7); floodfill(110,270,7); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,7); floodfill(110,320,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); tm=10; showmouseptr(); } p=x;m=y; if(p>105&&p<345) {if((m>105&&m<155)&&tm!=1) {tm=1; hidemouseptr(); setcolor(123); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,123); floodfill(110,110,123); setcolor(7); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,7); floodfill(110,170,7); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,7); floodfill(110,220,7); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,7); floodfill(110,270,7); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,7); floodfill(110,320,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); showmouseptr(); } if((m>160&&m<205)&&tm!=2) { tm=2; hidemouseptr(); setcolor(123); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,123); floodfill(110,170,123); setcolor(7); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,7); floodfill(110,110,7); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,7); floodfill(110,220,7); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,7); floodfill(110,270,7); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,7); floodfill(110,320,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); showmouseptr(); } if((m>210&&m<255)&&tm!=3) { tm=3; hidemouseptr(); setcolor(123); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,123); floodfill(110,220,123); setcolor(7); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,7); floodfill(110,170,7); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,7); floodfill(110,110,7); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,7); floodfill(110,270,7); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,7); floodfill(110,320,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); showmouseptr(); } if((m>260&&m<305)&&tm!=4) {tm=4; hidemouseptr(); setcolor(123); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,123); floodfill(110,270,123); setcolor(7); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,7); floodfill(110,170,7); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,7); floodfill(110,220,7); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,7); floodfill(110,110,7); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,7); floodfill(110,320,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); showmouseptr(); } if((m>310&&m<345)&&tm!=5) {tm=5; hidemouseptr(); setcolor(123); rectangle(105,310,345,345); setfillstyle(SOLID_FILL,123); floodfill(110,320,123); setcolor(7); rectangle(105,160,345,205); setfillstyle(SOLID_FILL,7); floodfill(110,170,7); rectangle(105,210,345,255); setfillstyle(SOLID_FILL,7); floodfill(110,220,7); rectangle(105,105,345,155); setfillstyle(SOLID_FILL,7); floodfill(110,110,7); rectangle(105,260,345,305); setfillstyle(SOLID_FILL,7); floodfill(110,270,7); setcolor(RED); settextstyle(1,0,5); outtextxy(130,106," NEW "); outtextxy(130,161," EASY "); outtextxy(130,211," EXIT "); outtextxy(95,255," LOAD GAME"); outtextxy(105,300,"TURNAMENT"); rectangle(100,100,350,350); showmouseptr(); } if(m<105||m>345) if(tm!=0) tm=0; } else if(tm!=0) tm=0; if((button & 1)==1) {if(x>=105&&x<=345) { if(y>=210&&y<=255) break; if(y>=105&&y<=155) {result=0; hidemouseptr(); new1(); continue; } if(y>=160&&y<=250) {result=0; hidemouseptr(); easy(); continue; } if(y>=260&&y<=305) {result=0; save2(); continue; } if(y>=310&&y<=345) {result=0; turna(); continue; } }} delay(100); } }