void handle_minute_tick(struct tm *time, TimeUnits units_changed) { if(!clock_is_24h_style() && time->tm_hour > 12) { time->tm_hour -= 12; } if(!clock_is_24h_style() && time->tm_hour == 0) { time->tm_hour = 12; } setSegs(bl[0], bl[1], time->tm_hour); setSegs(bl[3], bl[4], time->tm_min); #if(DATE) setSegs(bl[5], bl[6], time->tm_mon+1); setSegs(bl[8], bl[9], time->tm_mday+1); #endif }
void Element::setElementEffectByIndex(int eidx) { deleteGrid(); setBlendType(RenderObject::BLEND_DEFAULT); alpha.stop(); alpha = 1; elementEffectIndex = eidx; ElementEffect e = dsq->getElementEffectByIndex(eidx); switch(e.type) { case EFX_SEGS: { setSegs(e.segsx, e.segsy, e.segs_dgox, e.segs_dgoy, e.segs_dgmx, e.segs_dgmy, e.segs_dgtm, e.segs_dgo); setStatic(false); } break; case EFX_ALPHA: { setBlendType(e.blendType); alpha = e.alpha; setStatic(false); } break; case EFX_WAVY: { /* char buf[256]; sprintf(buf, "setting wavy segsy: %d radius: %d min: %d max: %d", e.segsy, e.wavy_radius, e.wavy_min, e.wavy_max); debugLog(buf); */ wavy.resize(e.segsy); float bity = float(getHeight())/float(e.segsy); for (int i = 0; i < wavy.size(); i++) { wavy[i] = Vector(0, -(i*bity)); } //wavySave = wavy; wavyRadius = e.wavy_radius; wavyFlip = e.wavy_flip; wavyMin = bity; wavyMax = bity*1.2f; //wavyRadius = 8; createGrid(2, e.segsy); setGridFromWavy(); //createGrid(8,8); /* wavyMin = e.wavy_min; wavyMax = e.wavy_max; */ setStatic(false); } break; default: setStatic(true); break; } elementEffectType = e.type; }
SchoolFish::SchoolFish() : FlockEntity() { burstDelay = 0; naijaReaction = "smile"; rippleTimer = 0; oldFlockID = -1; respawnTimer = 0; dodgeAbility = (rand()%900)/1000.0 + 0.1; float randScale = float(rand()%200)/1000.0; scale = Vector(0.6-randScale, 0.6-randScale); /* float randColor = float(rand()%250)/1000.0; color = Vector(1-randColor, 1-randColor, 1-randColor); */ //color.interpolateTo(Vector(0.5, 0.5, 0.5), 2, -1, 1); color.path.addPathNode(Vector(1,1,1), 0); color.path.addPathNode(Vector(1,1,1), 0.5); color.path.addPathNode(Vector(0.8, 0.8, 0.8), 0.7); color.path.addPathNode(Vector(1,1,1), 1.0); color.startPath(2); color.loopType = -1; color.update((rand()%1000)/1000.0); flipDelay = 0; swimSound = "SchoolFishSwim"; soundDelay = (rand()%300)/100.0; range = 0; setEntityType(ET_ENEMY); canBeTargetedByAvatar = true; health = maxHealth = 1; //scale = Vector(0.5, 0.5); avoidTime=0; vel = Vector(-minUrgency, 0); setTexture("flock-0001"); flockType = FLOCK_FISH; //updateCull = -1; updateCull = 4000; collideRadius = 20; //2 32 0.1 0.1 -0.03 0 4 0 setSegs(8, 2, 0.1, 0.9, 0, -0.03, 8, 0); /* setDamageTarget(DT_AVATAR_SPORECHILD, false); setDamageTarget(DT_AVATAR_ENERGYBLAST, false); */ //setAllDamageTargets(true); setDamageTarget(DT_AVATAR_LIZAP, false); /* setDamageTarget(DT_AVATAR_ENERGYBLAST, false); setDamageTarget(DT_AVATAR_SHOCK, false); */ //setDamageTarget(DT_AVATAR_BITE, true); // updateCull = 10248; targetPriority = -1; setEatType(EAT_FILE, "SchoolFish"); this->deathSound = ""; this->targetPriority = -1; setDamageTarget(DT_AVATAR_PET, false); }