int main() { volatile unsigned int * buf = (unsigned int*)(0x80000200); unsigned int i = 0; /* T1 takes 56 cycles to reach sync point T0 takes 10 cycles to reach sync point 56 - 10 = 46 cycles to synchronize T1 takes 7 cycles to do the loops and store in array to get back to sync point */ //76 - 10 // with fd DEAD(97); //51 DEAD(46); /* Begin critical section */ for (i = 0; ; i++ ) { //(i = 10; i > 0; i--) { *buf = i; DEAD(16); // with fd DEAD(55); } /* Exit critical section */ return 0; }
void delay(){ if(Frequency_MMC==LOW){ DEAD(864); DEAD(0); } else { DEAD(17); DEAD(0); } }
int main() { int i; DEAD(PERIOD); //for (i = 0; i < 20; ++i) { for(;;) { DEAD(PERIOD); WRITE(*observe); WRITE('\n'); } //DEAD(2000); //END_SIMULATION; }
int main() { int i; DEAD(50000); for (i = 0; /* FOREVER */ ; i++) { DEAD(500000); printf(" / \\ \n"); } return 0; }
int main() { int i; DEAD(3900); for (i = 0; /* FOREVER */ ; i++) { DEAD(LOOP_DELAY); puts(" \\___/ "); } return 0; }
int main() { #if defined(THREAD_0) while (1){ DEAD(30); *SPEED = GO; DEAD(30); *SPEED = BACKUP; } *SPEED = STOP; #endif WAIT_FOR_END_SIMULATION; }
int main() { int i; DEAD(200000); for (i = 0; /* FOREVER */ ; i++) { DEAD(500000); printf(" | ___ | \n"); printf(" \\ \\_/ / \n"); } return 0; }
GLOBAL void TP_Msg_KillMe_f (void) { extern cvar_t tp_name_rl, tp_name_lg; MSGPART point = ""; MSGPART kill_me = "{&cb1akill me [&cfff}{%l}{&cf2a]&cfff}"; MSGPART weapon = ""; MSGPART weapon_ammo = ""; MSGPART extra_rockets = ""; MSGPART extra_cells = ""; if (DEAD()) return; TP_FindPoint(); if (INPOINT(teammate)) point = va ("{&c0b0%s&cfff} ", Macro_PointName()); // Saying teammate kill me isn't much help. Only report if you can say e.g. Up2 Kill Me! if (HOLD_RL()) { weapon = tp_name_rl.string; weapon_ammo = ":$rockets "; } else if (HOLD_LG()) { weapon = tp_name_lg.string; weapon_ammo = ":$cells "; } if (!HOLD_RL() && HAVE_ROCKETS()) extra_rockets = "{&cf13r&cfff}:$rockets "; // see below comment if (!HOLD_LG() && HAVE_CELLS()) extra_cells = "{&c2aac&cfff}:$cells"; //the "r" and "c" are hard-coded to have the same colors as tp_name_rl and tp_name_lg. Not sure if this is a good idea //since the user can change those colors and then it won't match up TP_Send_TeamSay("%s%s %s%s%s%s", point, kill_me, weapon, weapon_ammo, extra_rockets, extra_cells); }
GLOBAL void TP_Msg_Safe_f (void) { extern cvar_t tp_name_rlg, tp_name_separator; MSGPART armor = ""; MSGPART separator = ""; MSGPART weapon = ""; if (DEAD()) return; TP_FindPoint(); // needed to make sure the area is, in fact, safe if (INPOINT(enemy) && !(INPOINT(quaded) || INPOINT(pented))) { return; //if you see an enemy without powerup, the place is still not 100% safe. But maybe you can handle him, so don't report anything yet. } if (INPOINT(enemy) && (INPOINT(quaded) || INPOINT(pented))) { TP_Msg_EnemyPowerup_f(); // if you see an enemy with a powerup, place is definitely not secure. report enemy powerup. return; } if ((HAVE_RA() || HAVE_YA() || HAVE_GA()) && (HAVE_RL() || HAVE_LG())) separator = tp_name_separator.string; if (HAVE_RA() || HAVE_YA() || HAVE_GA()) armor = "$colored_armor"; if (HAVE_RL() && HAVE_LG()) weapon = tp_name_rlg.string; else if (HAVE_RL() || HAVE_LG()) weapon = "$bestweapon"; TP_Send_TeamSay("%s %s%s%s", "{&c0b0safe&cfff} {&c0b0[&cfff}{%l}{&c0b0]&cfff}", armor, separator, weapon); }
int main() { // Deadline of 42 makes thread2 synchronized to start every loop iteration // in sync with thread1 (since thread 1 has an extra instuction at start of // main to offset stack pointer) DEAD(42); // Deadline of 45 would make thread2 and thread1 perform their loads in sync //DEAD(45) volatile unsigned int * buf = (unsigned int*)(0x80000200); volatile unsigned int * fd = (unsigned int*)(0x80000600); unsigned int i = 0; /* */ //76 - 10 // with fd DEAD(97); //51 /* Begin critical section */ for (i = 0; ; i++ ) { //(i = 10; i > 0; i--) { DEADI("00A"); *fd = *buf; // with fd DEAD(55); } /* Exit critical section */ return 0; }
GLOBAL void TP_Msg_Lost_f (void) { MSGPART quad = ""; MSGPART over = ""; MSGPART dropped_or_lost = ""; MSGPART location_enemy = " {&cf00[&cfff}{%d}{&cf00]&cfff} {%E}"; extern cvar_t tp_name_quad; if (DEAD()) { if (HAVE_QUAD()) { quad = tp_name_quad.string; over = " over "; location_enemy = "{&cf00[&cfff}{%d}{&cf00]&cfff} {%E}"; } else dropped_or_lost = "{&cf00lost&cfff}"; if (HOLD_RL() || HOLD_LG()) { dropped_or_lost = "{&cf00DROPPED} $weapon"; location_enemy = " {&cf00[&cfff}{%d}{&cf00]&cfff} {%E}"; } } else dropped_or_lost = "{&cf00lost&cfff}"; TP_Send_TeamSay("%s%s%s%s", quad, over, dropped_or_lost, location_enemy); }
GLOBAL void TP_Msg_Need_f (void) { MSGPART powerup = ""; MSGPART need = ""; if (DEAD()) return; // if you're dead, you need better aim :E TP_GetNeed(); if (NEED(health) || NEED(armor) || NEED_WEAPON() || NEED(rockets) || NEED(cells) || NEED(shells) || NEED(nails)) { need = "need %u $[{%l}$]"; } if (HAVE_POWERUP()) { powerup = tp_ib_name_team " $colored_powerups "; } if (need[0] == 0 && powerup[0] == 0) return; TP_Send_TeamSay("%s%s", powerup, need); }
GLOBAL void TP_Msg_Lost_f (void) { // Even though tp_msgreport is the same thing as this when dead, it's still useful to have tp_msglost for reporting last lost location after respawning MSGPART msg1 = ""; MSGPART msg2 = ""; if (DEAD()) { if (HAVE_QUAD()) { msg1 = tp_ib_name_quad " over "; } if (HOLD_RL() || HOLD_LG() || HOLD_GL()) // gl could be useful too { msg2 = "{&cf00lost&cfff} " COLORED(f0f,$weapon) " $[{%d}$] %E"; } else { msg2 = "{&cf00lost&cfff} $[{%d}$] %E"; } } else // if currently alive, then report last death location msg1 = "{&cf00lost&cfff} $[{%d}$] %E"; TP_Send_TeamSay("%s%s", msg1, msg2); }
GLOBAL void TP_Msg_Report_f (void) { extern cvar_t tp_name_lg, tp_name_rl, tp_name_gl, tp_name_sng, tp_name_ssg; MSGPART powerup = ""; MSGPART armor_health = "$colored_armor/%h"; MSGPART location = "$[{%l}$]"; MSGPART weapon = ""; MSGPART rl = ""; // note we need by "rl" "lg" and "weapon" for the case that player has both MSGPART lg = ""; MSGPART cells = ""; MSGPART extra_cells = ""; //"extra" MSGPART needed to we can put these after %l MSGPART rockets = ""; MSGPART extra_rockets = ""; MSGPART ammo = ""; if (DEAD()) { TP_Msg_Lost_f(); return; } if (HAVE_POWERUP()) powerup = "$colored_powerups "; if (HAVE_RL() && HAVE_LG()) { rl = tp_name_rl.string; rockets = ":$rockets "; lg = tp_name_lg.string; cells = ":$cells "; } else if (HAVE_RL()) { rl = tp_name_rl.string; rockets = ":$rockets "; } else if (HAVE_LG()) { lg = tp_name_lg.string; cells = ":$cells "; } else if (HAVE_GL()) { weapon = tp_name_gl.string; ammo = ":$rockets "; } else if (HAVE_SNG()) { weapon = tp_name_sng.string; ammo = ":$nails "; } else if (HAVE_SSG()) { weapon = tp_name_ssg.string; ammo = ":$shells "; } // extra rockets and cells if (!HAVE_RL() && HAVE_ROCKETS()) extra_rockets = " {&cf13r&cfff}:$rockets"; // see below comment if (!HAVE_LG() && HAVE_CELLS()) extra_cells = " {&c2aac&cfff}:$cells"; //the "r" and "c" are hard-coded to have the same colors as tp_name_rl and tp_name_lg. Not sure if this is a good idea //since the user can change those colors and then it won't match up TP_Send_TeamSay("%s%s %s%s%s%s%s%s%s%s%s", powerup, armor_health, weapon, ammo, rl, rockets, lg, cells, location, extra_rockets, extra_cells); }
int main() { int i; DEAD(100000); for (i = 0; /* FOREVER */ ; i++) { DEAD(500000); if (i % 4 == 3) { printf(" | ^ ^ | \n"); } else { printf(" | o o | \n"); } } return 0; }
int main() { int i; DEAD(1400); for (i = 0; /* FOREVER */ ; i++) { DEAD(LOOP_DELAY); if (i % 4 == 3) { puts(" | ^ ^ | "); } else { puts(" | o o | "); } } return 0; }
GLOBAL void TP_Msg_Took_f (void) { extern cvar_t tp_name_lg, tp_name_rl, tp_name_gl, tp_name_sng, tp_name_backpack, tp_name_cells, tp_name_rockets, tp_name_mh, tp_name_ra, tp_name_ya, tp_name_ga, tp_name_flag, tp_name_rune1, tp_name_rune2, tp_name_rune3, tp_name_rune4; MSGPART took = ""; MSGPART at_location = " $[{%Y}$]"; // %Y is took location, remembers for 15 secs MSGPART powerup = ""; MSGPART took_msg = ""; if (TOOK_EMPTY()) return; if (TOOK(quad) || TOOK(pent) || TOOK(ring)) { TP_GetNeed(); if (DEAD()) { TP_Msg_QuadDead_f(); return; } // Note that we check if you are holding powerup. This is because TOOK remembers for 15 seconds. // So a case could arise where you took quad then died less than 15 seconds later, and you'd be reporting "team need %u" (because $colored_powerups would be empty) else if ((NEED(health) || NEED(armor) || NEED_WEAPON() || NEED(rockets) || NEED(cells)) && HAVE_POWERUP()) took = "{&c0b0team&cfff} $colored_powerups need %u"; else if (HAVE_QUAD() || HAVE_RING()) // notice we can't send this check to tp_msgenemypwr, because if enemy with powerup is in your view, tp_enemypwr reports enemypwr first, but in this function you want to report TEAM powerup. took = "{&c0b0team&cfff} $colored_powerups"; else { // In this case, you took quad or ring and died before 15 secs later. So just report what you need, nothing about powerups. took = "need %u"; //notice we don't say quad over, because it could be that you held ring. No way to distinguish } } else { if (TOOK(rl)) took = tp_name_rl.string; else if (TOOK(lg)) took = tp_name_lg.string; else if (TOOK(gl)) took = tp_name_gl.string; else if (TOOK(sng)) took = tp_name_sng.string; else if (TOOK(pack)) took = tp_name_backpack.string; else if (TOOK(cells)) took = tp_name_cells.string; else if (TOOK(rockets)) took = tp_name_rockets.string; else if (TOOK(mh)) took = tp_name_mh.string; else if (TOOK(ra)) took = tp_name_ra.string; else if (TOOK(ya)) took = tp_name_ya.string; else if (TOOK(ga)) took = tp_name_ga.string; else if (TOOK(flag)) took = tp_name_flag.string; else if (TOOK(rune1)) took = tp_name_rune1.string; else if (TOOK(rune2)) took = tp_name_rune2.string; else if (TOOK(rune3)) took = tp_name_rune3.string; else if (TOOK(rune4)) took = tp_name_rune4.string; else took = "{$took}"; // This should never happen took_msg = "took "; if (HAVE_POWERUP()) powerup = "$colored_powerups "; else powerup = ""; } TP_Send_TeamSay("%s%s%s%s", powerup, took_msg, took, at_location); }
bool local_apetStatInit(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet) { CAPet* apet = ch->GetAPet(); if (apet == NULL) { CNetMsg::SP rmsg(new CNetMsg); ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 1); SEND_Q( rmsg , ch->m_desc ); return false; } CItem *pPetItem = ch->m_wearInventory.wearItemInfo[ WEARING_PET ]; if( !pPetItem ) // 착용중인 펫 아이템 없음 { CNetMsg::SP rmsg(new CNetMsg); ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 1); SEND_Q( rmsg , ch->m_desc ); return false; } if( pPetItem->getFlag() & FLAG_ITEM_SEALED || DEAD( apet ) ) // 봉인또는 죽었음 { CNetMsg::SP rmsg(new CNetMsg); ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 2); SEND_Q( rmsg , ch->m_desc ); return false; } if( !( apet->m_nPlusStr || apet->m_nPlusCon || apet->m_nPlusDex || apet->m_nPlusInt ) ) // 초기화할 스텟 없음 { CNetMsg::SP rmsg(new CNetMsg); ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 3); SEND_Q( rmsg , ch->m_desc ); return false; } // 이전 스텟 로그 GAMELOG << init("APET_STAT_INIT BEFORE",ch ) << "REMAIN:" << apet->m_nRemainStat << delim << "STR:" << apet->m_nPlusStr << delim << "DEX:" << apet->m_nPlusDex << delim << "INT:" << apet->m_nPlusInt << delim << "CON:" << apet->m_nPlusCon << end; apet->InitStat(); // 사용후 스텟 로그 GAMELOG << init("APET_STAT_INIT AFTER",ch ) << "REMAIN:" << apet->m_nRemainStat << delim << "STR:" << apet->m_nPlusStr << delim << "DEX:" << apet->m_nPlusDex << delim << "INT:" << apet->m_nPlusInt << delim << "CON:" << apet->m_nPlusCon << end; { CNetMsg::SP rmsg(new CNetMsg); ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 0); SEND_Q( rmsg , ch->m_desc ); } return true; }
bool CAPet::AddExpSP( LONGLONG exp, int sp, bool bDirect ) { if( GetStmLevel() > 1 || GetFaithLevel() > 1 ) // 충성도나 기아 레벨 2 이상이면 경험치 획득 없음 return false; if( m_level >= MAX_APET_LEVEL ) return false; if( DEAD(this) ) return false; LONGLONG add_exp =0; if (m_level <= MAX_APET_LEVEL) add_exp = exp; if (m_level >= MAX_APET_LEVEL && m_exp > GetNeedExp()) add_exp = GetNeedExp(); if ( sp > 0 ) m_nSP += sp; if(bDirect == false) { if( add_exp > 0 && m_pOwner->m_assist.m_avAddition.hcPetExpBoost == true ) { m_pOwner->m_assist.CureByItemIndex(7344); add_exp = 4 * add_exp; } if( m_pOwner->m_assist.m_avAddition.hcCashPetExpUp_2358 == true ) add_exp = 2 * add_exp; else if( m_pOwner->m_assist.m_avAddition.hcCashPetExpUp_2359 == true ) add_exp = 3 * add_exp; #ifdef DOUBLE_PET_EXP if( gserver->m_bDoublePetExpEvent == true ) add_exp = add_exp * gserver->m_PetExpPercent / 10000000; #endif // DOUBLE_PET_EXP } if(add_exp > exp * (1500000 / 1000)) // 1500%이상 못먹게 함. { add_exp = exp * (1500000 / 1000); } m_exp += add_exp; if ( m_exp < 0 ) m_exp = 0; if (m_nSP > MAX_SKILLPOINT) m_nSP = MAX_SKILLPOINT; CalcLevelup(); return true; }
int main() { DEAD(480); volatile unsigned int * buf = (unsigned int*)(0x3FFF0200); volatile unsigned int * fd = (unsigned int*)(0x80000100); unsigned int i = 0; // Loop takes 29 cycles // Critical section takes 10 for (i = 0; i < 95; i++ ) { DEAD(280); /* Begin critical section */ *fd = *buf; /* Exit critical section */ } *fd = '\n'; asm(".word 0x22222222"); return 0; }
int main() { volatile unsigned int * buf = (unsigned int*)(0x3FFF0200); unsigned int i; for (i = ' '; ; i++ ) { DEAD(26); /* Begin critical section */ *buf = i; /* Exit critical section */ } return 0; }
void do_ReformSystem(CPC *ch, CNetMsg::SP& msg) { if (ch == NULL) return ; if (DEAD(ch)) { CNetMsg::SP rmsg(new CNetMsg); ReformerSystemRep(rmsg, MSG_EX_REFORMER_SYSTEM_EXCEPTION_ERROR_REP); SEND_Q(rmsg, ch->m_desc); } do_Reform(ch, msg); }
int main() { volatile unsigned int * buf = (unsigned int*)(0x3FFF0200); unsigned int i; for (i = ' '; ; i++ ) { DEAD(30); /* Begin critical section */ *buf = i; /* Exit critical section */ } WAIT_FOR_END_SIMULATION; }
//////////////////// // Function name : GetDistance // Description : 캐릭터 사이의 거리 계산 // Return type : float // : 거리 반환 // Argument : CCharacter* ch // : 기준 캐릭터 // Argument : CCharacter* tch // : 측정 캐릭터 float GetDistance(CCharacter* ch, CCharacter* tch) { if (ch == tch) return 0; if (ch == NULL || tch == NULL) return 0; if (DEAD(tch)) return 0; float ret = GetDistance(GET_X(ch), GET_X(tch), GET_Z(ch), GET_Z(tch), GET_H(ch), GET_H(tch)); ret -= ch->GetSize(); ret -= tch->GetSize(); return (ret > 0.0f) ? ret : 0.0f; }
int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj) { trig_data *t; char buf[MAX_INPUT_LENGTH]; int ret_val; if (!SCRIPT_CHECK(ch, MTRIG_RECEIVE) || AFF_FLAGGED(ch, AFF_CHARM)) return 1; for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if (TRIGGER_CHECK(t, MTRIG_RECEIVE) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { ADD_UID_VAR(buf, t, actor, "actor", 0); ADD_UID_VAR(buf, t, obj, "object", 0); ret_val = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW); if (DEAD(actor) || DEAD(ch) || obj->carried_by != actor) return 0; else return ret_val; } } return 1; }
bool CAPet::IncreaseStat() { bool bChanged = false; if(this->GetOwner()->m_petStashManager.GetPetItemByPlus(this->m_index)) { //창고에 보관중인 상태일때는 충성도, 배고픔 수치 1시간당 1씩 회복 if ( m_nPetStashSeconds + (60 * 60/*sec*/) < gserver->m_nowseconds) { m_nPetStashSeconds = gserver->m_nowseconds; AddFaith(1); AddStamina(1); this->GetOwner()->m_petStashManager.UpdatePetData(this->m_index); } } else if( IsWearing() && !DEAD(this) ) { if ( m_nHpMpPulse + PULSE_REAL_SEC*20 < gserver->m_pulse) { m_nHpMpPulse = gserver->m_pulse; m_hp += m_recoverHP; m_mp += m_recoverMP; if ( m_hp > (m_maxHP + GetOwner()->m_opJewelElementPetHPUP) ) m_hp = m_maxHP + GetOwner()->m_opJewelElementPetHPUP; if ( m_mp > (m_maxMP) ) m_mp = m_maxMP; bChanged = true; } // 기아가 아닐때만 충성도 증가 if ( GetStmLevel() == 0 && m_nFaithPulse + (PULSE_REAL_MIN*5) < gserver->m_pulse) { m_nFaithPulse = gserver->m_pulse; int leveldef = ( m_pOwner->m_level - m_level ) / 2 ; int nAddFaith = 1 + (leveldef>0? leveldef:0); AddFaith( nAddFaith ); bChanged = true; } } else { } return bChanged; }
LOCAL void TP_Msg_GetPentQuad(qbool quad) { MSGPART get_powerup = ""; TP_FindPoint(); if (quad) { if (DEAD() && HAVE_QUAD()) { // player messed up, he's dead with quad, so there's no quad to get! TP_Msg_Lost_f(); return; } else if (INPOINT(eyes) && INPOINT(quaded)) { return; // Don't know for sure if it's enemy or not, and can't assume like we do in tp_enemypwr because this isn't tp_ENEMYpwr } else if (INPOINT(quaded)) { TP_Msg_EnemyPowerup_f(); // let tp_msgenemypwr handle it... return; } else { get_powerup = "get " tp_ib_name_quad; } } else // get pent { if (INPOINT(eyes) && INPOINT(pented)) { return; // Don't know for sure if it's enemy or not, and can't assume like we do in tp_enemypwr because this isn't tp_ENEMYpwr } else if (HAVE_PENT() || INPOINT(pented)) // if anyone has pent, as long as they dont have ring { TP_Msg_EnemyPowerup_f(); // send to tp_enemypwr return; } else { get_powerup = "get " tp_ib_name_pent; } } //$Y$Y get powerup(1) TP_Send_TeamSay("%s", get_powerup); }
GLOBAL void TP_Msg_QuadDead_f (void) { extern cvar_t tp_name_quad; MSGPART quad = tp_name_quad.string; MSGPART dead = "dead/over"; TP_FindPoint(); if (HAVE_QUAD() && DEAD()) { TP_Msg_Lost_f(); // we use this function because it checks for dropped RL's, etc return; } else if (INPOINT(quaded)) { // This check is to make sure the button is not pressed accidentally. TP_Msg_EnemyPowerup_f(); // tp_enemypwr can handle this & all cases regarding players/powerups return; } TP_Send_TeamSay("%s %s", quad, dead); }
GLOBAL void TP_Msg_QuadDead_f (void) { MSGPART quad_dead = ""; TP_FindPoint(); if (DEAD() && HAVE_QUAD()) // when you have quad and you die, before you spawn you're still glowing (in some mods/settings), meaning you have quad. this check is necessary! { TP_Msg_Lost_f(); return; } else if (HAVE_QUAD() || INPOINT(quaded)) // If ANYONE has quad { // This check is to make sure the button is not pressed accidentally. (how can you report quad dead if you see quad?) TP_Msg_EnemyPowerup_f(); // tp_enemypwr can handle this & all cases regarding players/powerups return; } else quad_dead = tp_ib_name_quad " dead/over"; TP_Send_TeamSay("%s",quad_dead); }
int get_otrigger(obj_data *obj, char_data *actor) { trig_data *t; char buf[MAX_INPUT_LENGTH]; int ret_val; if (!SCRIPT_CHECK(obj, OTRIG_GET)) return 1; for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) { if (TRIGGER_CHECK(t, OTRIG_GET) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { ADD_UID_VAR(buf, t, actor, "actor", 0); ret_val = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW); /* Don't allow a get to take place, if the actor is killed (the mud * would choke on obj_to_char) or the object is purged. */ if (DEAD(actor) || !obj) return 0; else return ret_val; } } return 1; }