VOID CGameFrameDlg::OnSound() { if (IsEnableSound()==true) { EnableSound(false); } else { EnableSound(true); } HINSTANCE hInstancleMe=GetModuleHandle(GAME_FRAME_DLL_NAME); m_btSound.SetButtonImage(m_bAllowSound?IDB_SOUND1:IDB_SOUND0, hInstancleMe, false); }
//游戏设置 void CGameClientDlg::OnGameOptionSet() { //构造数据 CGameOption GameOption; GameOption.m_dwCardHSpace=m_dwCardHSpace; GameOption.m_bEnableSound=IsEnableSound(); GameOption.m_bDeasilOrder=m_GameClientView.IsDeasilOrder(); //配置数据 if (GameOption.DoModal()==IDOK) { //获取参数 m_bDeasilOrder=GameOption.m_bDeasilOrder; m_dwCardHSpace=GameOption.m_dwCardHSpace; //设置控件 EnableSound(GameOption.m_bEnableSound); m_GameClientView.SetUserOrder(GameOption.m_bDeasilOrder); m_GameClientView.m_HandCardControl.SetCardSpace(m_dwCardHSpace,0,20); //保存配置 AfxGetApp()->WriteProfileInt(TEXT("GameOption"),TEXT("CardSpace"),m_dwCardHSpace); AfxGetApp()->WriteProfileInt(TEXT("GameOption"),TEXT("DeasilOrder"),m_bDeasilOrder?TRUE:FALSE); } return; }
//游戏设置 void CGameClientDlg::OnGameOptionSet() { //构造数据 CGameOption GameOption; //GameOption.m_dwCardHSpace=m_dwCardHSpace; GameOption.m_bEnableSound=IsEnableSound(); GameOption.m_bAllowLookon=IsAllowUserLookon(); //配置数据 if (GameOption.DoModal()==IDOK) { //设置扑克 //m_dwCardHSpace=GameOption.m_dwCardHSpace; //for (int i=0;i<GAME_PLAYER;i++) m_GameClientView.m_CardControl[i].SetCardSpace(m_dwCardHSpace); //设置配置 EnableSound(GameOption.m_bEnableSound); AllowUserLookon(0,GameOption.m_bAllowLookon); //保存配置 //AfxGetApp()->WriteProfileInt(TEXT("GameOption"),TEXT("CardSpace"),m_dwCardHSpace); } return; }
//游戏设置 void CGameClientDlg::OnGameOptionSet() { //构造数据 CGameOption GameOption; GameOption.m_bEnableSound=IsEnableSound(); GameOption.m_bAllowLookon=IsAllowUserLookon(); //配置数据 if (GameOption.DoModal()==IDOK) { EnableSound(GameOption.m_bEnableSound); AllowUserLookon(0,GameOption.m_bAllowLookon); } return; }
//--------------------------------------------------------------------------- bool APIENTRY DllMain(HINSTANCE hinst, unsigned long reason, void*) { HInstance = hinst; OutptTxt("DLL EntryPoint"); if(reason==DLL_PROCESS_ATTACH) { OutptTxt("Process Attached"); GetSysDir(); SetupFileMap(); DataShare = reinterpret_cast<DataSharePTR>(pMapView); SetupLocalFileMap(); LocalShare = reinterpret_cast<LocalSharePTR>(LocalpMapView); if(!LocalShare) OutptTxt("Error creating shared lmap"); else OutptTxt("lmap success"); Windowed = false; SetupTAHookFileMap(); DataShare->IsRunning = 5; EnableSound(); //IncreaseWeaponID(); } if(reason==DLL_PROCESS_DETACH) { /* KillTimer(NULL, Timer); KillTimer(NULL, DetectTimer); */ FreeLibrary(SDDraw); ShutdownLocalFileMap(); ShutDownTAHookFileMap(); /* if(lpTAFrontBuf) lpTAFrontBuf->Release(); if(lpTABackBuf) lpTABackBuf->Release(); if(lpTADD2) lpTADD2->Release(); if(BlitSurf) BlitSurf->Release(); */ } return 1; }
//游戏设置 void CGameClientDlg::OnGameOptionSet() { //构造数据 CGameOption GameOption; GameOption.m_bEnableSound=IsEnableSound(); GameOption.m_bShowChessName=m_bShowChessName; //配置数据 if (GameOption.DoModal()==IDOK) { //设置变量 m_bShowChessName=GameOption.m_bShowChessName; //保存配置 AfxGetApp()->WriteProfileInt(TEXT("GameOption"),TEXT("ShowChessName"),m_bShowChessName); //功能设置 EnableSound(GameOption.m_bEnableSound); m_GameClientView.m_ChessBorad.ShowChessName(m_bShowChessName); } return; }
void CAccessory::PickUp(EntityId pickerId, bool sound, bool select/* =true */, bool keepHistory/* =true */, const char *setup /*= NULL*/) { CActor *pActor=GetActor(pickerId); if (!pActor) return; TriggerRespawn(); GetEntity()->EnablePhysics(false); Physicalize(false, false); bool soundEnabled = IsSoundEnabled(); EnableSound(sound); SetViewMode(0); SetOwnerId(pickerId); CopyRenderFlags(GetOwner()); Hide(true); m_stats.dropped = false; m_stats.detached = false; m_stats.brandnew = false; IInventory *pInventory = pActor->GetInventory(); if (!pInventory) { GameWarning("Actor '%s' has no inventory, when trying to pickup '%s'!",pActor->GetEntity()->GetName(),GetEntity()->GetName()); return; } if (!pActor->IsPlayer() || pActor->IsClient() || gEnv->bMultiplayer) { bool hasAccessory = pInventory->HasAccessory(GetEntity()->GetClass()); bool hasAccessoryForThisWeapon = pInventory->HasAccessory(GetEntity()->GetClass()); if (!hasAccessoryForThisWeapon) pInventory->AddAccessory(GetEntity()->GetClass()); if (!hasAccessory) ProcessAccessoryAmmoCapacities(pInventory, true); if (!hasAccessoryForThisWeapon) ProcessAccessoryAmmo(pInventory); } OnPickedUp(pickerId, m_sharedparams->params.unique); if (select) { PlayAction(GetFragmentIds().pickedup); } EnableSound(soundEnabled); bool isLocalEntity = GetEntity()->GetFlags()&(ENTITY_FLAG_CLIENT_ONLY|ENTITY_FLAG_SERVER_ONLY) ? true : false; if (IsServer() && !IsDemoPlayback()) { if(!gEnv->bMultiplayer || isLocalEntity) RemoveEntity(); else if(g_pGame->GetGameRules()) g_pGame->GetGameRules()->ScheduleEntityRemoval(GetEntityId(),10.0f,false); //Give some time to the clients to pick the msg } if (IsServer()) { GetGameObject()->SetNetworkParent(pickerId); if (!isLocalEntity) { pActor->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClPickUp(), CActor::PickItemParams(GetEntityId(), m_stats.selected, sound), eRMI_ToAllClients|eRMI_NoLocalCalls, GetEntityId()); } } }
void CAccessory::PickUp(EntityId pickerId, bool sound, bool select, bool keepHistory, const char *setup) { CActor *pActor=GetActor(pickerId); if (!pActor) return; if(!CheckAmmoRestrictions(pickerId)) { if (IsServer()) g_pGame->GetGameRules()->SendTextMessage(eTextMessageCenter, "@ammo_maxed_out", eRMI_ToClientChannel, pActor->GetChannelId(), (string("@")+GetEntity()->GetClass()->GetName()).c_str()); return; } TriggerRespawn(); GetEntity()->EnablePhysics(false); Physicalize(false, false); bool soundEnabled = IsSoundEnabled(); EnableSound(sound); SetViewMode(0); SetOwnerId(pickerId); CopyRenderFlags(GetOwner()); Hide(true); m_stats.dropped = false; m_stats.brandnew = false; IInventory *pInventory = pActor->GetInventory(); if (!pInventory) { GameWarning("Actor '%s' has no inventory, when trying to pickup '%s'!",pActor->GetEntity()->GetName(),GetEntity()->GetName()); return; } if(!pInventory->HasAccessory(GetEntity()->GetClass())) { pInventory->AddAccessory(GetEntity()->GetClass()); } OnPickedUp(pickerId, m_sharedparams->params.unique); PlayAction(g_pItemStrings->pickedup); EnableSound(soundEnabled); if (IsServer() && !IsDemoPlayback()) { if(!gEnv->bMultiplayer) RemoveEntity(); else if(g_pGame->GetGameRules()) g_pGame->GetGameRules()->ScheduleEntityRemoval(GetEntityId(),10.0f,false); //Give some time to the clients to pick the msg } if (IsServer()) { GetGameObject()->SetNetworkParent(pickerId); if ((GetEntity()->GetFlags()&(ENTITY_FLAG_CLIENT_ONLY|ENTITY_FLAG_SERVER_ONLY)) == 0) { pActor->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClPickUp(), CActor::PickItemParams(GetEntityId(), m_stats.selected, sound), eRMI_ToAllClients|eRMI_NoLocalCalls, GetEntityId()); const char *displayName=GetDisplayName(); } } }
/************************************ * Main program * ************************************/ int32_t main() { int32_t quit = 0,i, correct,number; char buf[257]; char *langs[]={ "US\0","DE\0","SE\0","FR\0","IT\0", }; /* Read UAE configuration */ i = GetUaeConfig( &config ); while( quit == 0 ) { printf(" UAE-Control v0.1\n\n"); printf(" 1) Reset\n"); printf(" 2) Debug\n"); printf(" 3) Exit Emulator\n"); printf(" 4) Change framerate (Currently : %ld)\n", config.framerate); printf(" 5) Toggle sound (Currently : %s)\n", config.do_output_sound ? "ON" : "OFF"); printf(" 6) Toggle fake joystick (Currently : %s)\n", config.do_fake_joystick ? "ON" : "OFF"); printf(" 7) Change language (Currently : %s)\n", langs[config.keyboard]); printf(" 8) Eject a disk\n"); printf(" 9) Insert a disk\n"); printf("10) Exit UAE-Control\n\n"); correct = 0; while( correct == 0 ) { printf(" Command : "); gets( buf ); i = atoi( buf ); if ((i > 0) && (i < 11)) correct = 1; } switch( i ) { case 1: HardReset(); break; case 2: DebugFunc(); break; case 3: ExitEmu(); break; case 4: printf(" Enter new framerate (1-20) :"); gets( buf ); number = atoi( buf ); if (SetFrameRate (number)) GetUaeConfig(&config); else printf(" Illegal value, not changed.\n"); break; case 5: if (config.do_output_sound) DisableSound(); else EnableSound(); GetUaeConfig( &config ); break; case 6: if (config.do_fake_joystick) DisableJoystick(); else EnableJoystick(); GetUaeConfig( &config ); break; case 7: printf(" 1 = US, 2 = DE, 3 = SE, 4 = FR, 5 = IT\n"); printf(" What will it be : "); gets( buf ); number = atoi( buf ); if ((number >= 1) && (number <= 5)) { ChangeLanguage( number-1 ); GetUaeConfig( &config ); } else { printf(" Illegal value, not changed.\n"); } break; case 8: print_drive_status(); printf(" Eject which drive (1-4): "); gets( buf ); number = atoi( buf ); if ((number >= 1) && (number <=4 )) { EjectDisk( number-1 ); GetUaeConfig( &config ); } else { printf(" Illegal drive, not changed.\n"); } break; case 9: print_drive_status(); printf(" Enter disk to drive (1-4): "); gets( buf ); number = atoi( buf ); if ((number >= 1) && (number <= 4)) { printf("Name of diskfile :"); gets( buf ); InsertDisk( (UBYTE *)&buf, number - 1 ); GetUaeConfig( &config ); } else { printf(" Illegal drive, not changed.\n"); } break; case 10: quit = 1; break; } } quit_program(0, ""); return(0); }
/***************************************** * Main program * *****************************************/ int main() { int quit = 0, i; struct IntuiMessage *msg; struct Gadget *button; struct StringInfo *strinfo; char buf[257]; UWORD koodi, msgID; ULONG classi, number; APTR address; ULONG CycleTags[3]; CycleTags[0] = GTCY_Active; CycleTags[1] = (ULONG) & number; CycleTags[2] = TAG_DONE; /* Read UAE configuration */ i = GetUaeConfig(&config); i = setup_window(); if (i == 0) { quit_program(1, "Cannot setup a window!"); return 1; } while (quit == 0) { WaitPort(window->UserPort); while (msg = (struct IntuiMessage *) GT_GetIMsg(window->UserPort)) { classi = msg->Class; koodi = msg->Code; address = msg->IAddress; if (classi == IDCMP_GADGETUP) { msgID = ((struct Gadget *) msg->IAddress)->GadgetID; button = (struct Gadget *) msg->IAddress; if (button->SpecialInfo) { strinfo = (struct StringInfo *) button->SpecialInfo; } } else msgID = msg->Code; GT_ReplyIMsg((struct IntuiMessage *) msg); switch (classi) { case IDCMP_CLOSEWINDOW: quit = 1; break; case IDCMP_GADGETUP: switch (msgID) { case GAD_EXITEMU: ExitEmu(); break; case GAD_EJECT_DF0: EjectDisk(0); Delay(30); GetUaeConfig(&config); print_drive_status(); break; case GAD_EJECT_DF1: EjectDisk(1); Delay(30); GetUaeConfig(&config); print_drive_status(); break; case GAD_EJECT_DF2: EjectDisk(2); Delay(30); GetUaeConfig(&config); print_drive_status(); break; case GAD_EJECT_DF3: EjectDisk(3); Delay(30); GetUaeConfig(&config); print_drive_status(); break; case GAD_SOUND: if (config.do_output_sound) DisableSound(); else EnableSound(); Delay(30); GetUaeConfig(&config); break; case GAD_JOYSTICK: if (config.do_fake_joystick) DisableJoystick(); else EnableJoystick(); Delay(30); GetUaeConfig(&config); break; case GAD_FRAMERATE: SetFrameRate(strinfo->LongInt); Delay(30); GetUaeConfig(&config); break; case GAD_INSERT_DF0: strcpy(buf, config.df0_name); if (get_string(buf, 255)) { InsertDisk((UBYTE *) buf, 0); Delay(30); GetUaeConfig(&config); print_drive_status(); } break; case GAD_INSERT_DF1: strcpy(buf, config.df1_name); if (get_string(buf, 255)) { InsertDisk((UBYTE *) buf, 1); Delay(30); GetUaeConfig(&config); print_drive_status(); } break; case GAD_INSERT_DF2: strcpy(buf, config.df2_name); if (get_string(buf, 255)) { InsertDisk((UBYTE *) buf, 2); Delay(30); GetUaeConfig(&config); print_drive_status(); } break; case GAD_INSERT_DF3: strcpy(buf, config.df3_name); if (get_string(buf, 255)) { InsertDisk((UBYTE *) buf, 3); Delay(30); GetUaeConfig(&config); print_drive_status(); } break; case GAD_LANGUAGE: number = config.keyboard; number++; if (number == 5) number = 0; ChangeLanguage(number); Delay(30); GetUaeConfig(&config); break; case GAD_RESET: ColdReboot(); break; case GAD_DEBUG: DebugFunc(); break; default: break; } break; default: break; } } } quit_program(0, ""); return (0); }