void EnnemiSmurfette::onAvance() { static const int marche_droite[] = { 315, 316, 317, 318, 319, 318, 317, 316 }; static const int marche_gauche[] = { 320, 321, 322, 323, 324, 323, 322, 321 }; static const int SPEED = 1; tombe(); // Marche // if (x - SPEED < xmin || mur_opaque(x - SPEED, y) || (plat(x - SPEED, y) == 0 && plat(x - SPEED, y + 5) == 0)) dir = SENS_DROITE; else if (x + SPEED > offset + 640 || mur_opaque(x + SPEED, y) || (plat(x + SPEED, y) == 0 && plat(x + SPEED, y + 5) == 0)) dir = SENS_GAUCHE; if (dir == SENS_DROITE) { marche(SPEED); pic = pbk_ennemis[anime(marche_droite, 8, 6)]; } else { marche(-SPEED); pic = pbk_ennemis[anime(marche_gauche, 8, 6)]; } if (etape_shoot >= wait_shoot && x > offset + 10 && x < offset + 630) { etape = ss_etape = 0; etat = ETAT_TIRE; onTire(); return; } colFromPic(); }
MachSyscall makeFromID(Process::ptr proc, MachSyscall::SyscallIDIndependent id) { Architecture arch = proc->getArchitecture(); OSType os = proc->getOS(); Platform plat(arch,os); return MachSyscall::makeFromPlatform(plat, id); }
void EnnemiToad::onSaute() { int yp; tombe(); // Et si on arrêtait de tomber ? // if (dy > 0 && (yp = plat(x, y + dy)) != 0) { etat = ETAT_NORMAL; dy = 0; y = yp; etape = 0; ss_etape = 0; onAvance(); return; } if (dir == SENS_DROITE) { x += speed; pic = pbk_ennemis[3]; } else { x -= speed; pic = pbk_ennemis[7]; } colFromPic(); }
/*! Un second lot d'objets : 1 table, 1 théière, 4 chaises !*/ static void lot2(void) { glPushMatrix(); /* une table */ table(0); /* une coupe avec des fruits */ glPushMatrix(); glTranslatef(0.5,0.2,+2.1); glRotatef(60.,0.,0.,1.); plat(); glPopMatrix(); /* 3 chaises */ glPushMatrix(); glTranslatef(-1.75,0.,0.); glRotatef(40.,0.,0.,1.); Material(bleu,0.25,0.5,0.0,1.0,1.); chaise(1); glPopMatrix(); glPushMatrix(); glTranslatef(0.,-1.2,0.); glRotatef(100.,0.,0.,1.); Material(rouge,0.25,0.5,0.0,1.0,1.); chaise(0); glPopMatrix(); glPushMatrix(); glTranslatef(+2.5,0.,0.); glRotatef(140.,0.,0.,1.); Material(vert,0.25,0.5,0.0,1.0,1.); chaise(0); glPopMatrix(); glPopMatrix(); }
void EnnemiSnorkyBase1::onTombe() { tombe(); if (plat(x, y) != 0) etat = ETAT_AVANCE; colFromPic(); }
void EnnemiToad::onMeure() { /*if (dy<-5) dy-=5; if (dy<-2) dy=0;*/ tombe(); ss_etape += 1; ss_etape %= 6; if (ss_etape == 0 && etape < 10) etape += 1; if ((etape > 4) && (hokuto > 0)) { hokuto--; etape -= 4; } if (etape == 5 && ss_etape == 0) { sbk_misc.play(9 + rand() % 2); } if (etape >= 10) { int yy = plat(x, y); if (yy != 0 && yy != y_plat[4][x]) { grave(x, y, pic); a_detruire = true; } } else { if (dir == SENS_GAUCHE) { if (!mur_opaque(x - speed, y) && plat(x, y) == 0) x -= speed; pic = pbk_ennemis[18 + etape]; } else { if (!mur_opaque(x + speed, y) && plat(x, y) == 0) x += speed; pic = pbk_ennemis[8 + etape]; } } }
MachSyscall makeFromEvent(const EventSyscall * ev) { Process::const_ptr proc = ev->getProcess(); Architecture arch = proc->getArchitecture(); OSType os = proc->getOS(); Platform plat(arch,os); MachSyscall::SyscallIDPlatform syscallNumber = ev->getSyscallNumber(); #if !defined(os_windows) MachSyscall::SyscallName syscallName = MachSyscall::nameLookup(plat, syscallNumber); #else MachSyscall::SyscallName syscallName = "Unknown"; #endif return MachSyscall(plat, syscallNumber, syscallName); }
nsISupports* OS2Uni::GetUconvObject(int aCodePage, ConverterRequest aReq) { if (gCharsetManager == nullptr) { CallGetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &gCharsetManager); } nsresult rv; nsISupports* uco = nullptr; for (int i = 0; i < eCONVERTER_COUNT; i++) { if (aCodePage == gConverterInfo[i].mCodePage) { if (gConverterInfo[i].mEncoder == nullptr) { const char* convname; nsAutoCString charset; if (aCodePage == 0) { nsCOMPtr<nsIPlatformCharset> plat(do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) { plat->GetCharset(kPlatformCharsetSel_FileName, charset); } else { // default to IBM850 if this should fail charset = "IBM850"; } convname = charset.get(); } else { convname = gConverterInfo[i].mConvName; } rv = gCharsetManager->GetUnicodeEncoderRaw(convname, &gConverterInfo[i].mEncoder); gConverterInfo[i].mEncoder-> SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, '?'); gCharsetManager->GetUnicodeDecoderRaw(convname, &gConverterInfo[i].mDecoder); NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get converter"); } if (aReq == eConv_Encoder) { uco = gConverterInfo[i].mEncoder; } else { uco = gConverterInfo[i].mDecoder; } break; } } return uco; }
const char * nsDefaultURIFixup::GetFileSystemCharset() { if (mFsCharset.IsEmpty()) { nsresult rv; nsCAutoString charset; nsCOMPtr<nsIPlatformCharset> plat(do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) rv = plat->GetCharset(kPlatformCharsetSel_FileName, charset); if (charset.IsEmpty()) mFsCharset.AssignLiteral("ISO-8859-1"); else mFsCharset.Assign(charset); } return mFsCharset.get(); }
void FondPokeAscenceur2::update() { if (game_flag[2] > 1) { int xtmp; // Fait des allers/retour // if (y <= 96) dy = 1; else if (y >= 387) dy = -1; // Si un joueur est sur la plateforme, on le déplace // Sprite * joueur; list_joueurs.start(); while (!list_joueurs.fin()) { joueur = (Sprite*) list_joueurs.info(); xtmp = joueur->x; if (xtmp > x && xtmp < x + pic->xSize() && plat(xtmp, joueur->y) == y + 20) joueur->y += dy; list_joueurs.suivant(); } // Déplace la plateforme // y += dy; for (int i = x; i < x + pic->xSize(); i++) y_plat[4][i] = y + 20; colFromPic(); if (x < offset - 400) a_detruire = true; } else { y = -60; } }
void MorceauTeteRayman::update() { x += dx; tombe(); ss_etape ++; ss_etape %= 4; if (ss_etape == 0) { etape ++; etape %= 8; pic = pbk_ennemis[496 + etape]; } // Et si la tete touche le sol? ? // if (dy > 0 && (plat(x, y + dy)) != 0) { grave(x, y, pic); a_detruire = true; } }
void EnnemiSnorkyBase1::onAvance() { if (plat(x, y) == 0) { etat = ETAT_TOMBE; dy = 0; lat_grav = 0; onTombe(); return; } wait_for_shoot++; if ((wait_for_shoot > shoot_delay) && ((dir == SENS_DROITE && x > offset + 40) || (dir == SENS_GAUCHE && x < offset + 600))) { wait_for_shoot = 0; shoot_delay = 50 + rand() % 200; etape = 0; ss_etape = 0; etat = ETAT_TIRE; onTire(); return; } if (dir == SENS_GAUCHE) { marche(-SNORKY_BASE_SPEED); pic = pbk_ennemis[anime(anim_snorky_base_marche_gauche, 8, 4)]; if (mur_opaque(x - SNORKY_BASE_SPEED, y) || (x - SNORKY_BASE_SPEED < xmin)) dir = SENS_DROITE; } else { marche(SNORKY_BASE_SPEED); pic = pbk_ennemis[anime(anim_snorky_base_marche_droite, 8, 4)]; if (mur_opaque(x + SNORKY_BASE_SPEED, y) || (x + SNORKY_BASE_SPEED > offset + 640)) dir = SENS_GAUCHE; } colFromPic(); }
void EnnemiSnorkyBase1::onMeure() { tombe(); ss_etape += 1; ss_etape %= 5; if (ss_etape == 0) etape += 1; if (etape == 4 && ss_etape == 1) { Sprite * s = new MorceauSnorkyBaseTeteEntiere(); s->dir = dir; s->y = y - 22; s->x = x; list_giclures.ajoute((void*) s); dy = 0; } if (etape == 14) { if (plat(x, y) != 0) { grave(x, y, pic); } a_detruire = true; } else { if (dir == SENS_GAUCHE) { marche(-SNORKY_BASE_SPEED); pic = pbk_ennemis[71 + etape]; } else { marche(SNORKY_BASE_SPEED); pic = pbk_ennemis[38 + etape]; } } }
void EnnemiBisouNuage::onMeureTombe() { tombe(); ss_etape += 1; ss_etape %= 8; if (ss_etape == 0) { etape += 1; etape %= 2; } if (dir == SENS_GAUCHE) pic = pbk_ennemis[234 + etape]; else pic = pbk_ennemis[232 + etape]; if (plat(x, y) != 0) { etape = ss_etape = 0; etat = ETAT_MEURE_4; // sbk_niveau.play( 25); } }
void EnnemiBulbizarre::onMeure() { tombe(); ss_etape += 1; ss_etape %= 5; if (ss_etape == 0 && etape < 8) etape += 1; if (etape >= 8) { int yy = plat(x, y); if (yy != 0 && yy != y_plat[4][x]) grave(x, y, pic); a_detruire = true; } else { if (dir == SENS_GAUCHE) pic = pbk_ennemis[36 + etape]; else pic = pbk_ennemis[28 + etape]; } }
void EnnemiToad::onAvance() { // Si plus de plateformes on passe dans l'etat TOMBE // if (plat(x, y) == 0) { etat = ETAT_TOMBE; dy = 0; etape = 0; ss_etape = 0; lat_grav = 0; onSaute(); } //pour marcher if (x - speed < xmin || mur_opaque(x - speed, y)) { dir = SENS_DROITE; speed = 1; } else if (x + speed > offset + 640 || mur_opaque(x + speed, y)) { dir = SENS_GAUCHE; speed = 1; } wait_for_charge++; if (wait_for_charge >= charge_delay) { if ((plat2(tete_turc->x, tete_turc->y) == plat2(x, y)) && (((dir == SENS_DROITE) && (x < tete_turc->x)) || ((dir == SENS_GAUCHE) && (x > tete_turc->x)))) { charge_etape = 0; speed = 0; etape = 0; ss_etape = 0; dy = 0; etat = ETAT_TIRE; sbk_niveau.play(34); onCharge(); return; } else { wait_for_charge = 0; charge_delay = 50 + rand() % 250; etape = 0; ss_etape = 0; etat = ETAT_SAUTE; dy = -7; lat_grav = 0; // Sinon les sauts diffèrent par leur hauteur onSaute(); return; } } if (dir == SENS_DROITE) { marche(speed); pic = pbk_ennemis[anime(anim_toad_marche_droite, 4, 12 - 3 * speed)]; } else { marche(-speed); pic = pbk_ennemis[anime(anim_toad_marche_gauche, 4, 12 - 3 * speed)]; } if (speed < TOAD_SPEED) { etape_speed++; if (etape_speed >= 30) { etape_speed = 0; speed++; } } colFromPic(); }
void OpenCLPlatform :: get_platforms(vector<OpenCLPlatform> &plats) { cl_platform_id platforms[MAX_PLATFORMS]; cl_uint num_platforms = 0; cl_int res = clGetPlatformIDs( MAX_PLATFORMS, platforms, &num_platforms ); if(opencl_error(res, "clGetPlatformIDs error querying platforms")) { return; } if(num_platforms <= 0) { opencl_error(USER_OPENCL_ERROR, "clGetPlatformIDs no OpenCL platforms detected"); return; } // clear out any previous platforms plats.clear(); static cl_platform_info param_names[] = { CL_PLATFORM_VENDOR, CL_PLATFORM_NAME, CL_PLATFORM_VERSION, CL_PLATFORM_PROFILE, CL_PLATFORM_EXTENSIONS }; int n_param_names = sizeof(param_names)/sizeof(cl_platform_info); for(int j=0; j < num_platforms; j++) { OpenCLPlatform plat(platforms[j]); for(int i=0; i < n_param_names; i++) { char param_value[PLATFORM_PARAM_SIZE]; size_t param_value_size_ret = 0; cl_int res = clGetPlatformInfo( platforms[j], param_names[i], PLATFORM_PARAM_SIZE, param_value, ¶m_value_size_ret ); if(opencl_error(res, "clGetPlatformInfo getting platform information")) { return; } switch(param_names[i]) { case CL_PLATFORM_VENDOR: plat.set_vendor(opencl_param<string>(param_value)); break; case CL_PLATFORM_NAME: plat.set_name(opencl_param<string>(param_value)); break; case CL_PLATFORM_VERSION: plat.set_version(opencl_param<string>(param_value)); break; case CL_PLATFORM_PROFILE: plat.set_profile(opencl_param<Profile>(param_value)); break; case CL_PLATFORM_EXTENSIONS: plat.set_extension(opencl_param<string>(param_value)); break; default: break; } } plats.push_back(plat); } }
void FondMonolite::update() { pic = pbk_niveau[anime(monolite_animation, 36, 3)]; //anime36 ss_etape_levitation++; ss_etape_levitation %= 4; if (ss_etape_levitation == 0) { etape_levitation++; if (etape_levitation == 44) { etape_levitation = 0; } } int xtmp; // Fait des allers/retour // /*if ( y <= 96) dy = 1; else if ( y >= 387) dy = -1;*/ // Si un joueur est sur la plateforme, on le déplace // Sprite * joueur; Sprite * ennemis; list_joueurs.start(); while (!list_joueurs.fin()) { joueur = (Sprite*) list_joueurs.info(); xtmp = joueur->x; if (xtmp >= x - 138 && xtmp < x + pic->xSize() - 118 && plat(xtmp, joueur->y) == y - 20) { if (etape_levitation <= 22) { joueur->y += monolite_levitation[etape_levitation]; } else { joueur->y -= monolite_levitation[etape_levitation - 22]; } } // joueur->y += dy; list_joueurs.suivant(); } list_ennemis.start(); while (!list_ennemis.fin()) { ennemis = (Sprite*) list_ennemis.info(); xtmp = ennemis->x; if (xtmp >= x - 138 && xtmp < x + pic->xSize() - 118 && plat(xtmp, ennemis->y) == y - 20) { if (etape_levitation <= 22) { ennemis->y += monolite_levitation[etape_levitation]; } else { ennemis->y -= monolite_levitation[etape_levitation - 22]; } } // joueur->y += dy; list_ennemis.suivant(); } // Déplace la plateforme // //y += dy; if (etape_levitation <= 22) { y += monolite_levitation[etape_levitation]; } else { y -= monolite_levitation[etape_levitation - 22]; } for (int i = x - 118; i < x + pic->xSize() - 138; i++) y_plat[4][i] = y - 20; colFromPic(); /*if ( x < offset-400) a_detruire = true;*/ }