import "std.zh" //Jump script ffc script Jump { int jumpforce_max; int jumpforce_cur=0; int i = 0; int floaty_max; int floaty = 0; int jump_pause = 0; void run() { float t; float dt = 0.016; float a = 313.6; //4x gravity. float v0 = -167.2; float yStart; bool bJumping=false; while (true) { if ( (Link->InputB) && (jump_pause == 0) && ((!canMove(Link->X+8, Link->Y+17)) || (!canMove(Link->X, Link->Y+17)) || (!canMove(Link->X+16, Link->Y+17))) ) { bJumping = true; t = dt; jump_pause = 20; yStart = Link->Y; Link->Y = yStart + v0*t + 0.5*a*t*t; } else if ( bJumping ) { if ( !canMove(Link->X+8, Link->Y+17) || !canMove(Link->X+8, Link->Y+4) || Link->Y >= yStart ) { bJumping = false; } else { t += dt; Link->Y = yStart + v0*t + 0.5*a*t*t; if ( Link->InputRight ) { Link->X++; //Link->InputRight = false; } else if ( Link->InputLeft ) { Link->X--; //Link->InputLeft = false; } } } else if ( jump_pause > 0 ) { jump_pause--; } Link->InputB = false; //so another effect doesn't happen. Waitframe(); } //int saveLinkY; // while (true) // { // jumpforce_max = 7; //floaty_max = 100; // // if ( (Link->InputB) && (jump_pause == 0) && // ((!canMove(Link->X+8, Link->Y+17)) || // (!canMove(Link->X, Link->Y+17)) || // (!canMove(Link->X+16, Link->Y+17))) ) // { // jumpforce_cur = jumpforce_max; // floaty = floaty_max; // jump_pause = 20; // } // if ( jumpforce_cur > 0 ) // { // if ( !canMove(Link->X+8, Link->Y+4)) //{ // jumpforce_cur = 0; // } // else // { // Link->Y = Link->Y - jumpforce_cur; // saveLinkY = Link->Y; // if ( i== 2 ) { i = 0; } // else { jumpforce_cur--; i++; } // } // } // else // { // if ( floaty > 0 ) // { // floaty--; // Link->Y = saveLinkY; // } // } Link->InputB = false; //so another effect doesn't happen. // // if ((!canMove(Link->X+8, Link->Y+17)) || // (!canMove(Link->X, Link->Y+17)) || // (!canMove(Link->X+16, Link->Y+17))) // { // jump_pause--; // if ( jump_pause < 1 ) { jump_pause = 0; } // } // Waitframe(); // } } bool canMove(int x, int y) { if ( x < 0 || x > 255 || y < 0 || y > 175 ) { return false; } int mask = 1111b; if (x%16<8) mask &= 0011b; else mask &= 1100b; if (y%16<8) mask &= 0101b; else mask &= 1010b; return ((Screen->ComboS[ComboAt(x, y)]&mask) == 0); } } ffc script UpArrowDoor { void run(int x, int y) { while (true) { if ( Link->X >= this->X && Link->X <= this->X+16 ) { if ( Link->Y >= this->Y && Link->Y <= this->Y+16 ) { if ( Link->Dir == DIR_UP ) { Screen->ComboD[ComboAt(x, y)] = 28; } } } Waitframe(); } } } ffc script UpArrowDoor_AB { void run(int x, int y, int offsX) { while (true) { if ( Link->X >= this->X && Link->X <= this->X+16 && Link->Y >= this->Y && Link->Y <= this->Y+16 ) { if ( Link->Dir == DIR_UP ) { Screen->ComboD[ComboAt(x, y)] = 28; } } else if ( Link->X >= this->X+offsX && Link->X <= this->X+16+offsX && Link->Y >= this->Y && Link->Y <= this->Y+16 ) { if ( Link->Dir == DIR_UP ) { Screen->ComboD[ComboAt(x,y)] = 29; } } Waitframe(); } } } ffc script NPC_Talk { int nTextVis = 0; int nOrigC; int nLastKeyA=0; int nTextUp=0; int nX; int nY; int C00; int C01; int C02; int C03; int C04; int C05; int C06; int C10; int C11; int C12; int C13; int C14; int C15; int C16; int C20; int C21; int C22; int C23; int C24; int C25; int C26; int C30; int C31; int C32; int C33; int C34; int C35; int C36; int C40; int C41; int C42; int C43; int C44; int C45; int C46; int C50; int C51; int C52; int C53; int C54; int C55; int C56; void run(int y, int nText, int nLookAt, int nRange, int nFrameOffs) { nLastKeyA = 0; nTextUp = 0; int x = this->X - 48; int nStartX = this->X; int nDir = 1; int nOrigCombo = this->Data; if ( x < 0 ) x = 0; else if ( x > 144 ) x = 144; while (true) { if ( nTextUp == 1 ) { Link->X = nX; Link->Y = nY; } else //animate? Only when text isn't up... { if ( nRange > 0 ) { if ( nDir == -1 && this->X < nStartX ) { this->X = nStartX; nDir = 1; this->Data = nOrigCombo; } else if ( nDir == 1 && this->X > nStartX + nRange ) { this->X = nStartX + nRange; nDir = -1; this->Data = nOrigCombo - 1; } else { this->X += nDir; } x = this->X - 48; if ( x < 0 ) x = 0; else if ( x > 144 ) x = 144; } else if (nLookAt == 1) //Just rotate to look at player. { if ( Link->X >= this->X ) { this->Data = nOrigCombo; } else { this->Data = nOrigCombo - 1; } } } if ( Link->X >= this->X-16 && Link->X <= this->X+16 && Link->Y >= this->Y-16 && Link->Y <= this->Y+32 ) { if ( Link->InputA && nLastKeyA == 0 ) { if ( nTextVis == 0 ) { nTextVis = 1; nTextUp = 1; nX = Link->X; nY = Link->Y; //1. Save old combos... C00 = Screen->ComboD[ComboAt(x+00, y)]; C01 = Screen->ComboD[ComboAt(x+16, y)]; C02 = Screen->ComboD[ComboAt(x+32, y)]; C03 = Screen->ComboD[ComboAt(x+48, y)]; C04 = Screen->ComboD[ComboAt(x+64, y)]; C05 = Screen->ComboD[ComboAt(x+80, y)]; C06 = Screen->ComboD[ComboAt(x+96, y)]; C10 = Screen->ComboD[ComboAt(x+00, y+16)]; C11 = Screen->ComboD[ComboAt(x+16, y+16)]; C12 = Screen->ComboD[ComboAt(x+32, y+16)]; C13 = Screen->ComboD[ComboAt(x+48, y+16)]; C14 = Screen->ComboD[ComboAt(x+64, y+16)]; C15 = Screen->ComboD[ComboAt(x+80, y+16)]; C16 = Screen->ComboD[ComboAt(x+96, y+16)]; C20 = Screen->ComboD[ComboAt(x+00, y+32)]; C21 = Screen->ComboD[ComboAt(x+16, y+32)]; C22 = Screen->ComboD[ComboAt(x+32, y+32)]; C23 = Screen->ComboD[ComboAt(x+48, y+32)]; C24 = Screen->ComboD[ComboAt(x+64, y+32)]; C25 = Screen->ComboD[ComboAt(x+80, y+32)]; C26 = Screen->ComboD[ComboAt(x+96, y+32)]; C30 = Screen->ComboD[ComboAt(x+00, y+48)]; C31 = Screen->ComboD[ComboAt(x+16, y+48)]; C32 = Screen->ComboD[ComboAt(x+32, y+48)]; C33 = Screen->ComboD[ComboAt(x+48, y+48)]; C34 = Screen->ComboD[ComboAt(x+64, y+48)]; C35 = Screen->ComboD[ComboAt(x+80, y+48)]; C36 = Screen->ComboD[ComboAt(x+96, y+48)]; C40 = Screen->ComboD[ComboAt(x+00, y+64)]; C41 = Screen->ComboD[ComboAt(x+16, y+64)]; C42 = Screen->ComboD[ComboAt(x+32, y+64)]; C43 = Screen->ComboD[ComboAt(x+48, y+64)]; C44 = Screen->ComboD[ComboAt(x+64, y+64)]; C45 = Screen->ComboD[ComboAt(x+80, y+64)]; C46 = Screen->ComboD[ComboAt(x+96, y+64)]; C50 = Screen->ComboD[ComboAt(x+00, y+80)]; C51 = Screen->ComboD[ComboAt(x+16, y+80)]; C52 = Screen->ComboD[ComboAt(x+32, y+80)]; C53 = Screen->ComboD[ComboAt(x+48, y+80)]; C54 = Screen->ComboD[ComboAt(x+64, y+80)]; C55 = Screen->ComboD[ComboAt(x+80, y+80)]; C56 = Screen->ComboD[ComboAt(x+96, y+80)]; //2. Replace combos... Screen->ComboD[ComboAt(x+00, y)] = 1024+nFrameOffs; Screen->ComboD[ComboAt(x+16, y)] = 1025+nFrameOffs; Screen->ComboD[ComboAt(x+32, y)] = 1025+nFrameOffs; Screen->ComboD[ComboAt(x+48, y)] = 1025+nFrameOffs; Screen->ComboD[ComboAt(x+64, y)] = 1025+nFrameOffs; Screen->ComboD[ComboAt(x+80, y)] = 1025+nFrameOffs; Screen->ComboD[ComboAt(x+96, y)] = 1026+nFrameOffs; Screen->ComboD[ComboAt(x+00, y+16)] = 1028+nFrameOffs; Screen->ComboD[ComboAt(x+16, y+16)] = nText+0; Screen->ComboD[ComboAt(x+32, y+16)] = nText+1; Screen->ComboD[ComboAt(x+48, y+16)] = nText+2; Screen->ComboD[ComboAt(x+64, y+16)] = nText+3; Screen->ComboD[ComboAt(x+80, y+16)] = nText+4; Screen->ComboD[ComboAt(x+96, y+16)] = 1030+nFrameOffs; Screen->ComboD[ComboAt(x+00, y+32)] = 1028+nFrameOffs; Screen->ComboD[ComboAt(x+16, y+32)] = nText+5; Screen->ComboD[ComboAt(x+32, y+32)] = nText+6; Screen->ComboD[ComboAt(x+48, y+32)] = nText+7; Screen->ComboD[ComboAt(x+64, y+32)] = nText+8; Screen->ComboD[ComboAt(x+80, y+32)] = nText+9; Screen->ComboD[ComboAt(x+96, y+32)] = 1030+nFrameOffs; Screen->ComboD[ComboAt(x+00, y+48)] = 1028+nFrameOffs; Screen->ComboD[ComboAt(x+16, y+48)] = nText+10; Screen->ComboD[ComboAt(x+32, y+48)] = nText+11; Screen->ComboD[ComboAt(x+48, y+48)] = nText+12; Screen->ComboD[ComboAt(x+64, y+48)] = nText+13; Screen->ComboD[ComboAt(x+80, y+48)] = nText+14; Screen->ComboD[ComboAt(x+96, y+48)] = 1030+nFrameOffs; Screen->ComboD[ComboAt(x+00, y+64)] = 1028+nFrameOffs; Screen->ComboD[ComboAt(x+16, y+64)] = nText+15; Screen->ComboD[ComboAt(x+32, y+64)] = nText+16; Screen->ComboD[ComboAt(x+48, y+64)] = nText+17; Screen->ComboD[ComboAt(x+64, y+64)] = nText+18; Screen->ComboD[ComboAt(x+80, y+64)] = nText+19; Screen->ComboD[ComboAt(x+96, y+64)] = 1030+nFrameOffs; Screen->ComboD[ComboAt(x+00, y+80)] = 1027+nFrameOffs; Screen->ComboD[ComboAt(x+16, y+80)] = 1031+nFrameOffs; Screen->ComboD[ComboAt(x+32, y+80)] = 1031+nFrameOffs; Screen->ComboD[ComboAt(x+48, y+80)] = 1031+nFrameOffs; Screen->ComboD[ComboAt(x+64, y+80)] = 1031+nFrameOffs; Screen->ComboD[ComboAt(x+80, y+80)] = 1031+nFrameOffs; Screen->ComboD[ComboAt(x+96, y+80)] = 1029+nFrameOffs; } else { nTextVis = 0; nTextUp = 0; //Restore combos... Screen->ComboD[ComboAt(x+00, y)] = C00; Screen->ComboD[ComboAt(x+16, y)] = C01; Screen->ComboD[ComboAt(x+32, y)] = C02; Screen->ComboD[ComboAt(x+48, y)] = C03; Screen->ComboD[ComboAt(x+64, y)] = C04; Screen->ComboD[ComboAt(x+80, y)] = C05; Screen->ComboD[ComboAt(x+96, y)] = C06; Screen->ComboD[ComboAt(x+00, y+16)] = C10; Screen->ComboD[ComboAt(x+16, y+16)] = C11; Screen->ComboD[ComboAt(x+32, y+16)] = C12; Screen->ComboD[ComboAt(x+48, y+16)] = C13; Screen->ComboD[ComboAt(x+64, y+16)] = C14; Screen->ComboD[ComboAt(x+80, y+16)] = C15; Screen->ComboD[ComboAt(x+96, y+16)] = C16; Screen->ComboD[ComboAt(x+00, y+32)] = C20; Screen->ComboD[ComboAt(x+16, y+32)] = C21; Screen->ComboD[ComboAt(x+32, y+32)] = C22; Screen->ComboD[ComboAt(x+48, y+32)] = C23; Screen->ComboD[ComboAt(x+64, y+32)] = C24; Screen->ComboD[ComboAt(x+80, y+32)] = C25; Screen->ComboD[ComboAt(x+96, y+32)] = C26; Screen->ComboD[ComboAt(x+00, y+48)] = C30; Screen->ComboD[ComboAt(x+16, y+48)] = C31; Screen->ComboD[ComboAt(x+32, y+48)] = C32; Screen->ComboD[ComboAt(x+48, y+48)] = C33; Screen->ComboD[ComboAt(x+64, y+48)] = C34; Screen->ComboD[ComboAt(x+80, y+48)] = C35; Screen->ComboD[ComboAt(x+96, y+48)] = C36; Screen->ComboD[ComboAt(x+00, y+64)] = C40; Screen->ComboD[ComboAt(x+16, y+64)] = C41; Screen->ComboD[ComboAt(x+32, y+64)] = C42; Screen->ComboD[ComboAt(x+48, y+64)] = C43; Screen->ComboD[ComboAt(x+64, y+64)] = C44; Screen->ComboD[ComboAt(x+80, y+64)] = C45; Screen->ComboD[ComboAt(x+96, y+64)] = C46; Screen->ComboD[ComboAt(x+00, y+80)] = C50; Screen->ComboD[ComboAt(x+16, y+80)] = C51; Screen->ComboD[ComboAt(x+32, y+80)] = C52; Screen->ComboD[ComboAt(x+48, y+80)] = C53; Screen->ComboD[ComboAt(x+64, y+80)] = C54; Screen->ComboD[ComboAt(x+80, y+80)] = C55; Screen->ComboD[ComboAt(x+96, y+80)] = C56; } nLastKeyA = 1; } else if ( !Link->InputA ) { nLastKeyA = 0; } } Waitframe(); } } } ffc script Monster_RatHead { void run(int nStartX, int nVelX) { this->X = nStartX; while (true) { if ( nVelX < 0 && this->X <= 0 ) { //reset with timer... this->X = nStartX; } else { this->X += nVelX; } if ( Link->Action == LA_ATTACKING && Link->X <= this->X && Link->X > this->X-8 ) { //kill it.. this->X = nStartX; } else if ( Link->X >= this->X-4 && Link->X <= this->X+20 ) { //damage link... Link->HP--; Link->Action = LA_GOTHURTLAND; } Waitframe(); } } } ffc script ScrollLR { float jTime; float yStart; bool bJumping; int jump_pause; int max_floor; ///////////////////////////// // This function handles sideview left/right scrolling (b15+) // Length: Length (in pixels) of the room. 768 = 3 screen widths. // nOpenStart: start of open area of background (0 = no open area) // nOpenEnd: end of open area of background (0 = no open area) // nFFC_Cnt: the number of ffcs to scroll. // nStartSolidFFC: The starting range of solid ffcs. // nEndSolidFFC: The end range of solid ffcs. // // The first ffc contain these arguments. // All ffc x positions are stored in an encode format // to allow them to be positioned anywhere in the virtual screen. // EncodeX = X/16. So scrolling ffcs must be place on tile boundaries. ///////////////////////////// void run(int Length, int MaxFloorHeight, int nOpenStart, int nOpenEnd, int nFFC_Cnt, int nStartSolidFFC, int nEndSolidFFC) { int nDelay = 0; int nLastLinkX = Link->X; int nLastLinkY = Link->Y; int x; int i; int vX = Link->X; int nNPCCnt = 0; int item_locX = -1; int item_locY = -1; int lastNPC_X0 = 0; bool bOnGround=false; ffc CurFFC; npc CurNPC; int nCeiling = Screen->ComboD[ ComboAt(0,0) ]; int nFloor = Screen->ComboD[ ComboAt(0,160) ]; int nB0 = Screen->ComboD[ ComboAt(0,16) ]; int nB1 = Screen->ComboD[ ComboAt(0,32) ]; int nB2 = Screen->ComboD[ ComboAt(0,48) ]; int nB3 = Screen->ComboD[ ComboAt(0,64) ]; int nB4 = Screen->ComboD[ ComboAt(0,80) ]; int nB5 = Screen->ComboD[ ComboAt(0,96) ]; int nB6 = Screen->ComboD[ ComboAt(0,112) ]; int nB7 = Screen->ComboD[ ComboAt(0,128) ]; int nB8 = Screen->ComboD[ ComboAt(0,144) ]; max_floor = MaxFloorHeight; jTime = 0; jump_pause = 0; bJumping = false; //decode x position into Ax for each FFC. //As long as we don't want to auto. move the FFCs //and we reset the Velocity each frame (to 0) then we //can store whatever we want in Ax and Ay. for (i=1; iLoadFFC(i); CurFFC->Ax = CurFFC->X*16; } //Scroll offset for floor/ceiling/background tiles. int nScrollOffs = 0; //now determine where in the virtual screen Link is based //on his starting position... //For now < 128 = 0, > 128 = end. if ( Link->X > 128 ) { //ok put him at the end, max scroll... vX = Link->X + Length-256; } while (true) { //clear up/down Link->InputUp = false; Link->InputDown = false; //go ahead and jump Link->Y = nLastLinkY; jump(); //compute desired movement. int nMove = Link->X - nLastLinkX; if ( nMove < -1) { nMove = -1; } else if ( nMove > 1) { nMove = 1; } if (Link->InputRight) { nMove = 1; Link->Dir = DIR_RIGHT; } else if ( Link->InputLeft ) { nMove = -1; Link->Dir = DIR_LEFT; } int nMoveY = Link->Y - nLastLinkY; //Check if Link can move, check collisions against the ffcs. int nColMask = HandleCollisions(nStartSolidFFC, nEndSolidFFC, vX+nMove, nLastLinkY+nMoveY); //nColMask is the collision edges: // 0 = no collisions. // 1 = left // 2 = right // 4 = top // 8 = bottom //16 = near ground. if ( (nMove>0&&!(nColMask&1)) || (nMove<0&&!(nColMask&2)) ) { vX += nMove; Link->X = nLastLinkX + nMove; } else { Link->X = nLastLinkX; nMove = 0; } if ( (nMoveY<0&&!(nColMask&8)) || (nMoveY>0&&!(nColMask&4)) || nMoveY == 0 ) { Link->Y = nLastLinkY + nMoveY; if ( Link->Y >= max_floor ) { bOnGround = true; } else if ( nMoveY ) { bOnGround = false; } else { bOnGround = (nColMask&16); } } else { Link->Y = nLastLinkY; bJumping = false; bOnGround = true; } //Make Link fall if not jumping and not on the ground.. //Should use real gravity like the jumping does.... if ( !bOnGround && !bJumping ) { Link->Y+=2; } else { Link->Fall = 0; } //now handle scrolling if ( vX < 0 ) { vX = 0; } if (vX > 128 && vX < Length-128) { if ( nMove > 0 ) { nScrollOffs = (nScrollOffs - 1); if ( nScrollOffs < 0 ) { nScrollOffs += 16; } Link->X = 128; } else if ( nMove < 0 ) { nScrollOffs = (nScrollOffs + 1)%16; Link->X = 128; } } if ( nOpenStart == 0 && nOpenEnd == 0 ) { for (x=0; x<16; x++) { Screen->ComboD[ 160+x ] = nFloor+nScrollOffs; Screen->ComboD[ 0+x ] = nCeiling+nScrollOffs; Screen->ComboD[ 16+x ] = nB0+nScrollOffs; Screen->ComboD[ 32+x ] = nB1+nScrollOffs; Screen->ComboD[ 48+x ] = nB2+nScrollOffs; Screen->ComboD[ 64+x ] = nB3+nScrollOffs; Screen->ComboD[ 80+x ] = nB4+nScrollOffs; Screen->ComboD[ 96+x ] = nB5+nScrollOffs; Screen->ComboD[ 112+x ] = nB6+nScrollOffs; Screen->ComboD[ 128+x ] = nB7+nScrollOffs; Screen->ComboD[ 144+x ] = nB8+nScrollOffs; } } else { for (x=0; x<16; x++) { Screen->ComboD[ 160+x ] = nFloor+nScrollOffs; if ( nOpenStart > 0 ) Screen->ComboD[ 0+x ] = nCeiling+nScrollOffs; if ( nOpenStart > 1 ) Screen->ComboD[ 16+x ] = nB0+nScrollOffs; if ( nOpenStart > 2 || nOpenEnd < 2 ) Screen->ComboD[ 32+x ] = nB1+nScrollOffs; if ( nOpenStart > 3 || nOpenEnd < 3 ) Screen->ComboD[ 48+x ] = nB2+nScrollOffs; if ( nOpenStart > 4 || nOpenEnd < 4 ) Screen->ComboD[ 64+x ] = nB3+nScrollOffs; if ( nOpenStart > 5 || nOpenEnd < 5 ) Screen->ComboD[ 80+x ] = nB4+nScrollOffs; if ( nOpenStart > 6 || nOpenEnd < 6 ) Screen->ComboD[ 96+x ] = nB5+nScrollOffs; if ( nOpenStart > 7 || nOpenEnd < 7 ) Screen->ComboD[ 112+x ] = nB6+nScrollOffs; if ( nOpenStart > 8 || nOpenEnd < 8 ) Screen->ComboD[ 128+x ] = nB7+nScrollOffs; if ( nOpenStart > 9 || nOpenEnd < 9 ) Screen->ComboD[ 144+x ] = nB8+nScrollOffs; } } nLastLinkX = Link->X; nLastLinkY = Link->Y; //Calculate the ffc offset based on scroll offset. int nOffs=0; if ( Link->X >= 128 ) { if ( vX < Length-128 ) { nOffs = vX-128; } else { nOffs = Length-256; } } //Move FFC's for (i=1; iLoadFFC(i); CurFFC->X = Min( Max(CurFFC->Ax - nOffs, -32), 272 ); CurFFC->Vx = 0; if ( CurFFC->X <= -31 ) { if ( CurFFC->EffectHeight > 16 ) { CurFFC->X = Min( Max(CurFFC->Ax+CurFFC->EffectWidth*16 - nOffs, -32), 272 ); } } } if ( nNPCCnt < Screen->NumNPCs() ) { nNPCCnt = Screen->NumNPCs(); for (i=0; iLoadNPC(i+1); CurNPC->BossPal = CurNPC->X;//*(Length/256)+i*16; CurNPC->Extend = 0; } } else { nNPCCnt = Screen->NumNPCs(); } //Move NPC's float newX; for (i=0; iLoadNPC(i+1); newX = CurNPC->BossPal - nOffs; if (newX < 0 || newX > 256) { CurNPC->X = -15; CurNPC->Extend = 0; if ( CurNPC->Y > max_floor ) { CurNPC->Y = max_floor; } } else { CurNPC->X -= (nOffs - CurNPC->Extend); CurNPC->Extend = nOffs; } } //Move items if ( Screen->NumItems() > 0 ) { item curItem = Screen->LoadItem(1); if ( item_locX == -1 ) { item_locX = curItem->X * (Length/256); item_locY = curItem->Y; } curItem->X = Min( Max(item_locX - nOffs, -32), 272 ); curItem->Y = item_locY; } Waitframe(); } } //Return true if there is a collision. int HandleCollisions(int nStartFFC, int nEndFFC, int x, int y) { if ( nStartFFC == 0 && nEndFFC == 0 ) { return 0; } int i; int nColMask = 0; for (i=nStartFFC; iLoadFFC(i); float tH = col->TileHeight*16; float tW = col->TileWidth*16; float cX = col->Ax; if (cX+128 < x && col->EffectHeight>16) { cX += col->EffectWidth*16; } if ( y+16 >= col->Y && y < col->Y+tH ) { if ( x+16 >= cX && x < cX+tW ) { if ( x+16 < cX+4 ) { nColMask |= 1; } else if ( x > cX+(tW-4) ) { nColMask |= 2; } if ( y > col->Y+(tH-4) ) { nColMask |= 8; } else if ( y+16 < col->Y+4 ) { nColMask |= 4; } } } else if ( y+18 >= col->Y && y < col->Y+tH ) { if ( x+16 >= cX && x < cX+tW ) { nColMask |= 16; } } } return nColMask; } //jump void jump() { float a = 313.6; float half_a = 0.5 * a; float v0 = -167.2; if ( Link->InputB && !bJumping && jump_pause == 0 ) { bJumping = true; jTime = 0.016; jump_pause = 20; yStart = Link->Y; Link->Y = yStart + v0*jTime + half_a*jTime*jTime; } else if ( bJumping ) { if ( Link->Y >= max_floor ) { bJumping = false; Link->Y = max_floor; } else { jTime += 0.016; Link->Y = yStart + v0*jTime + half_a*jTime*jTime; } } else if ( jump_pause > 0 ) { jump_pause--; } Link->InputB = false; } }