Exemplo n.º 1
0
void __cdecl ProgressCallback ( GHTTPRequest request, GHTTPState state, const char * buffer, GHTTPByteCount bufferLen, GHTTPByteCount bytesReceived, GHTTPByteCount totalSize, void * param )
{
	if (state == GHTTPReceivingFile && totalSize != 0)
		MainMenu()->OnDownloadPatchProgress(bytesReceived, totalSize);
}
Exemplo n.º 2
0
int main(void) 
{
  int choice;
  int ret;

  ret = eXdbmInit();
  if(ret==-1) {
    ErrorMessage();
    return(EXIT_FAILURE);
  }

  choice=-1;

  while(choice!=12) {
    choice = MainMenu();
    switch(choice) {
    case 1 : 
      OpenDatabase();
      break;

    case 2 :
      NewDatabase();
      break;

    case 3 : 
      CloseDatabase();
      break;

    case 4 :
      UpdateDatabase();
      break;

    case 5 : 
      BackupDatabase();
      break;

    case 6 :
      ReloadDatabase();
      break;

    case 7 :
      PrintDatabase();
      break;

    case 8 :
      PrintValues();
      break;

    case 9 :
      AddEntry();
      break;

    case 10:
      ChangeEntry();
      break;

    case 11 :
      DeleteEntry();
      break;
      
    }
  }

  printf("\n\nBye bye ...\n");

  return(1);
}
Exemplo n.º 3
0
static void MissionSet(void)
{
    SetWindowTitle();
    InitConfig();
    MainMenu();
}
Exemplo n.º 4
0
int main (int argc, char *argv[])
{
#ifdef HW_RVL
  /* initialize DVDX */
  DI_Init();
#endif

  /* initialize hardware */
  gx_video_Init();
  gx_input_Init();
#ifdef HW_DOL
  DVD_Init ();
  dvd_drive_detect();
#endif

  /* initialize FAT devices */
  if (fatInitDefault())
  {
    /* check for default directories */
    DIR_ITER *dir = NULL;

    /* base directory */
    char pathname[MAXPATHLEN];
    sprintf (pathname, DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* SRAM & Savestate files directory */ 
    sprintf (pathname, "%s/saves",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* Snapshot files directory */ 
    sprintf (pathname, "%s/snaps",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);

    /* Cheat files directory */ 
    sprintf (pathname, "%s/cheats",DEFAULT_PATH);
    dir = diropen(pathname);
    if (dir == NULL) mkdir(pathname,S_IRWXU);
    else dirclose(dir);
  }

  /* initialize sound engine */
  gx_audio_Init();

  /* initialize core engine */
  legal();
  config_default();
  history_default();
  init_machine();

  /* run any injected rom */
  if (cart.romsize)
  {
    ARAMFetch((char *)cart.rom, (void *)0x8000, cart.romsize);
    reloadrom (cart.romsize,"INJECT.bin");
    gx_video_Start();
    gx_audio_Start();
    frameticker = 1;
  }
  else
  {
    /* Main Menu */
    ConfigRequested = 1;
  }

  /* initialize GUI engine */
  GUI_Initialize();

#ifdef HW_RVL
  /* Power button callback */
  SYS_SetPowerCallback(Power_Off);
#endif

  /* main emulation loop */
  while (1)
  {
    /* Main Menu request */
    if (ConfigRequested)
    {
      /* stop video & audio */
      gx_audio_Stop();
      gx_video_Stop();

      /* show menu */
      MainMenu ();
      ConfigRequested = 0;

      /* start video & audio */
      gx_audio_Start();
      gx_video_Start();
      frameticker = 1;
    }

    if (frameticker > 1)
    {
      /* skip frame */
      system_frame(1);
      --frameticker;
    }
    else
    {
      while (frameticker < 1)
        usleep(10);

      /* render frame */
      system_frame(0);
      --frameticker;

      /* update video */
      gx_video_Update();
    }

    /* update audio */
    gx_audio_Update();
  }

  return 0;
}
Exemplo n.º 5
0
bool OnGossipHello(Player* player, Creature* creature) {
	MainMenu(player, creature);
	return true; }
Exemplo n.º 6
0
int
main(int argc, char *argv[])
{
    setlocale(LC_ALL, "en.UTF-8");
    geckoinit = InitGecko();

    if (hbcStubAvailable() || geckoinit)
    {
        InitTextVideo();
    }

    //	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
    //_break();

    __exception_setreload(5);                     //auto reset code dump nobody gives us codedump info anyways.

    gprintf("\n\n------------------");
    gprintf("\nUSB Loader GX rev%s",GetRev());
    gprintf("\nmain(%d", argc);
    for (int i=0;i<argc;i++)
        gprintf(", %s",argv[i]?argv[i]:"<NULL>");
    gprintf(")");

    // This part is added, because we need a identify patched ios
//    printf("\n\tReloading into ios 236");
    if (IOS_ReloadIOSsafe(236) < 0)
    {
//        printf("\n\tIOS 236 not found, reloading into 36");
        IOS_ReloadIOSsafe(36);
    }

    printf("\n\tStarting up");

    MEM2_init(36);                                // Initialize 36 MB
    MEM2_takeBigOnes(true);

    s32 ret;
    bool startupproblem = false;

    bool bootDevice_found=false;
    if (argc >= 1)
    {
        if (!strncasecmp(argv[0], "usb:/", 5))
        {
            strcpy(bootDevice, "USB:");
            bootDevice_found = true;
        } else if (!strncasecmp(argv[0], "sd:/", 4))
        bootDevice_found = true;
    }

    printf("\n\tInitializing controllers");

    /** PAD_Init has to be before InitVideo don't move that **/
    PAD_Init();                                   // initialize PAD/WPAD

    printf("\n\tInitialize USB (wake up)");

    USBDevice_Init();                             // seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")

    gprintf("\n\tChecking for stub IOS");
    ios222rev = getIOSrev(0x00000001000000dell);
    ios249rev = getIOSrev(0x00000001000000f9ll);

    //if we don't like either of the cIOS then scram
    if (!(ios222rev==4 || ios222rev==5 || (ios249rev>=9 && ios249rev<65280)))
    {
        InitTextVideo();
        printf("\x1b[2J");
        if ((ios222rev < 0 && ios222rev != WII_EINSTALL) && (ios249rev < 0 && ios249rev != WII_EINSTALL))
        {
            printf("\n\n\n\tWARNING!");
            printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
            printf("\n\n\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.");
            printf("\n\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,");
            printf("\n\tand you should go figure out how to get some cios action going on\n\tin your Wii.");
            printf("\n\n\tThis message will show every time.");
            sleep(5);
        }
        else
        {
            printf("\n\n\n\tERROR!");
            printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
            printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65280?" (Stubbed by 4.2 update)":"");
            printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65280?" (Stubbed by 4.2 update)":"");
            printf("\n\n\tGo figure out how to get some cIOS action going on\n\tin your Wii and come back and see me.");

            sleep(15);
            printf("\n\n\tBye");

            USBDevice_deInit();
            exit(0);
        }
    }

    printf("\n\tReloading ios 249...");
    ret = IOS_ReloadIOSsafe(249);

    printf("%d", ret);

    if (ret < 0)
    {
        printf("\n\tIOS 249 failed, reloading ios 222...");
        ret = IOS_ReloadIOSsafe(222);
        printf("%d", ret);

        if (ret < 0)
        {
            printf("\n\tIOS 222 failed, reloading ios 250...");
            ret = IOS_ReloadIOSsafe(250);
            printf("%d", ret);

            if(ret < 0)
            {
                printf("\n\tIOS 250 failed, reloading ios 223...");
                ret = IOS_ReloadIOSsafe(223);
                printf("%d", ret);

                if (ret < 0)
                {
                    printf("\n\tERROR: cIOS could not be loaded!\n");
                    sleep(5);
                    SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
                }
            }
        }
        printf("\n\tInitialize sd card");
        SDCard_Init();
        printf("\n\tLoad ehc module");
        load_ehc_module();
        printf("\n\tdeinit sd card");
        SDCard_deInit();
    }

    printf("\n\tInit wbfs...");
    ret = WBFS_Init(WBFS_DEVICE_USB);
    printf("%d", ret);

    if (ret < 0)
    {
        printf("\n\tYou have issues with a slow disc, or a difficult disc\n\tReloading 222...");
        ret = IOS_ReloadIOSsafe(222);
        printf("%d", ret);
        /*if(ret < 0) {
        //			printf("\n\tSleeping for 4 seconds");
        //			sleep(4);

            InitVideo(); // Initialise video
            Menu_Render();
            BootUpProblems();
            startupproblem = true;
            ret = 1;
        }*/
        printf("\n\tInitialize sd card");
        SDCard_Init();
        printf("\n\tLoad ehc module");
        load_ehc_module();
        printf("\n\tdeinit sd card");
        SDCard_deInit();

        printf("\n\tInitialize wbfs...");
        USBDevice_deInit();
        USBDevice_Init();
        ret = WBFS_Init(WBFS_DEVICE_USB);
        printf("%d", ret);

        if(ret < 0)
        {
            //			printf("\n\tSleeping for 4 seconds");
            //			sleep(4);
            InitVideo();                          // Initialise video
            Menu_Render();
            BootUpProblems();
            startupproblem = true;
            ret = 1;
        }
    }

    printf("\n\tInitialize sd card");
    SDCard_Init();                                // mount SD for loading cfg's

    //this should have already been done by now in order to WBFS_Init().
    printf("\n\tInitialize usb device");
    USBDevice_Init();                             // and mount USB:/

    if (!bootDevice_found)
    {
        printf("\n\tSearch for configuration file");

        //try USB
        //left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
        if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
            || checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
            || checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
            strcpy(bootDevice, "USB:");

        printf("\n\tConfiguration file is on %s", bootDevice);
    }

    // Try opening and closing the configuration file here
    // to prevent a crash dump later on - giantpune
    char GXGlobal_cfg[26];
    sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
    FILE *fp = fopen(GXGlobal_cfg, "r");
    if (fp)
    {
        fclose(fp);
    }

    gettextCleanUp();
    printf("\n\tLoading configuration...");
    CFG_Load();
    printf("done");
    //	gprintf("\n\tbootDevice = %s",bootDevice);

    /* Load Custom IOS */
    if ((Settings.cios == ios222 && IOS_GetVersion() != 222) ||
        (Settings.cios == ios223 && IOS_GetVersion() != 223))
    {
        printf("\n\tReloading IOS to config setting (%d)...", Settings.cios == ios222 ? 222 : 223);
        SDCard_deInit();                          // unmount SD for reloading IOS
        USBDevice_deInit();                       // unmount USB for reloading IOS
        USBStorage2_Deinit();
        ret = IOS_ReloadIOSsafe(Settings.cios == ios222 ? 222 : 223);
        printf("%d", ret);
        SDCard_Init();
        load_ehc_module();
        if (ret < 0)
        {
            SDCard_deInit();
            Settings.cios = ios249;
            ret = IOS_ReloadIOSsafe(249);
            // now mount SD:/  //no need to keep mindlessly mounting and unmounting SD card
            SDCard_Init();
        }

        USBDevice_Init();                         // and mount USB:/
        WBFS_Init(WBFS_DEVICE_USB);
    } else if ((Settings.cios == ios249 && IOS_GetVersion() != 249) ||
        (Settings.cios == ios250 && IOS_GetVersion() != 250))
    {

        printf("\n\tReloading IOS to config setting (%d)...", ios249 ? 249 : 250);
        SDCard_deInit();                          // unmount SD for reloading IOS
        USBDevice_deInit();                       // unmount USB for reloading IOS
        USBStorage2_Deinit();
        ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
        printf("%d", ret);
        if (ret < 0)
        {
            Settings.cios = ios222;
            ret = IOS_ReloadIOSsafe(222);
            SDCard_Init();
            load_ehc_module();
        }

        else SDCard_Init();                       // now mount SD:/  //no need to keep mindlessly mounting and unmounting SD card
        USBDevice_Init();                         // and mount USB:/
        WBFS_Init(WBFS_DEVICE_USB);
    }

    //	Partition_GetList(&partitions);

    if (ret < 0)
    {
        printf("\nERROR: cIOS could not be loaded!");
        sleep(5);
        exit(0);
        //SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
    }
    //gprintf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());//don't need gprintf if sending console shit to gecko, too
    printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());

    //	printf("Sleeping for 5 seconds\n");
    //	sleep(5);

    //if a ID was passed via args copy it and try to boot it after the partition is mounted
    //its not really a headless mode.  more like hairless.
    if (argc > 1 && argv[1])
    {
        if (strlen(argv[1])==6)
            strncpy(headlessID, argv[1], sizeof(headlessID));
    }

    //! Init the rest of the System
    Sys_Init();
    Wpad_Init();
    if(!startupproblem)
        InitVideo();
    InitAudio();                                  // Initialize audio

    WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
    WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);

    // load main font from file, or default to built-in font
    fontSystem = new FreeTypeGX();
    char *fontPath = NULL;
    asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
    fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
    fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
    free(fontPath);

    fontClock = new FreeTypeGX();
    fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
    fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);

    gprintf("\n\tEnd of Main()");
    InitGUIThreads();
    MainMenu(MENU_CHECK);
    return 0;
}
Exemplo n.º 7
0
    bool OnGossipSelect(Player* player, Creature* creature, uint32, uint32 uiAction)
    {
        player->PlayerTalkClass->ClearMenus(); //DATABASE_SLOT_OFFSET
        if(player->playerhouse && PlayerHousingMgr.GetCurrentHouseArea(player))
        {
            if(player->house == player->playerhouse->GetPhase() && PlayerHousingMgr.GetCurrentHouseArea(player)->id == player->playerhouse->houseTemplate->id)
            {
                if(uiAction == GOSSIP_ACTION_INFO_DEF)
                {
                    MainMenu(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 1) // Delete go or creature?
                {
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Back to menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
                    GameObject *object = player->playerhouse->GetNearestObject(player, creature);
                    if(object)
                    {
                        std::string name = "Remove object: " + PlayerHousingMgr.GetVendorItem((int)object->GetGOData()->id, false)->desc;
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, name, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); // REMOVE OBJECT
                    }
                    else
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "No object near", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);

                    Creature *creature2 = player->playerhouse->GetNearestCreature(player, creature);
                    if(creature2)
                    {
                        std::string name = "Remove npc: " + PlayerHousingMgr.GetVendorItem((int)creature2->GetCreatureData()->id * (-1), false)->desc;
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, name, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); // REMOVE NPC
                    }
                    else
                        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "No npc near", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
                    player->PlayerTalkClass->SendGossipMenu(907, creature->GetGUID());
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 2)
                {
                    player->pagehelper = 0;
                    player->categoryhelper = 2;
                    SelectNpcGo(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 3)
                {
                    player->pagehelper--;
                    if(player->categoryhelper == 2)
                        SelectNpcGo(player, creature);
                    else if(player->categoryhelper == 8)
                        Guests(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 4)
                {
                    player->pagehelper++;
                    if(player->categoryhelper == 2)
                        SelectNpcGo(player, creature);
                    else if(player->categoryhelper == 8)
                        Guests(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 5) // delete go
                {
                    PlayerHousingMgr.RemoveGameObject(player, player->playerhouse->GetNearestObject(player, creature));
                    MainMenu(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 6) // delete npc
                {
                    PlayerHousingMgr.RemoveCreature(player, player->playerhouse->GetNearestCreature(player, creature));
                    MainMenu(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 7) // Base loc
                {
                    player->TeleportTo(player->playerhouse->houseTemplate->map, player->playerhouse->houseTemplate->x, player->playerhouse->houseTemplate->y,
                                       player->playerhouse->houseTemplate->z, player->playerhouse->houseTemplate->o);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 8) // who can enter
                {
                    player->pagehelper = 0;
                    player->categoryhelper = 8;

                    Guests(player, creature);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 9) // delete house
                {
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "No, I changed my mind", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Yes, i'd like to delete this house", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 10) // delete house finish
                {
                    player->playerhouse->PackHouse(player);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 11) // leave house
                {
                    PlayerHousingMgr.LeaveHouse(player);
                }
                else if(uiAction == GOSSIP_ACTION_INFO_DEF + 12) // house acessories
                {
                    player->currentVendorEntry = -1;
                    player->GetSession()->SendListInventory(creature->GetGUID());
                }
                else if(uiAction > GOSSIP_ACTION_INFO_DEF + OFFSET_ADD_SOMETHING)
                {
                    if(player->categoryhelper == 2)
                    {
                        HouseItemList::iterator j;
                        uint32 id = uiAction - GOSSIP_ACTION_INFO_DEF - OFFSET_ADD_SOMETHING;
                        HouseItem *result = NULL;
                        int x = 0;
                        for (j = player->playerhouse->houseItemList.begin(); j != player->playerhouse->houseItemList.end(); ++j)
                        {
                            HouseItem *item = *j;
                            if(item->id == id)
                            {
                                result = item;
                            }

                            if(item->spawned)
                                x++;
                        }
                        if(result)
                        {
                            if(x < SOFT_LIMIT)
                            {
                                if(result->entry < 0)
                                    PlayerHousingMgr.SpawnCreature(player, result->entry);
                                else
                                    PlayerHousingMgr.SpawnGameObject(player, result->entry);
                                player->pagehelper = 0;
                            }
                            SelectNpcGo(player, creature);
                        }
                    }
                    else if(player->categoryhelper == 8)
                    {
                        if(uiAction - GOSSIP_ACTION_INFO_DEF - OFFSET_ADD_SOMETHING != player->GetGUIDLow())
                        {
                            PlayerHousingMgr.GuestChange(player, uiAction - GOSSIP_ACTION_INFO_DEF - OFFSET_ADD_SOMETHING, false);
                        }
                        player->pagehelper = 0;
                        Guests(player, creature);
                    }
                }
            }
        }
        if(uiAction != GOSSIP_ACTION_INFO_DEF + 12)
            player->PlayerTalkClass->SendGossipMenu(907, creature->GetGUID());
        return true;
    }
Exemplo n.º 8
0
//-----------------------------------------------------------------------------
int main(void)
{
    // Protect code from being overwritten
    MPU_createTwoSegments(__MSP430_BASEADDRESS_MPU__,0x0DC0,MPU_EXEC|MPU_READ,MPU_EXEC|MPU_READ|MPU_WRITE);
    MPU_start(__MSP430_BASEADDRESS_MPU__);


    // Check if a wakeup from LPMx.5 was detected and use a dedicated device-init flow and continue
    // previous program execution in that case.
    if (SYSRSTIV == SYSRSTIV_LPM5WU) {
        mode = APP_MAIN_MENU;
        select = 0;
    }
    else {              // Start up normally
        SystemInit();   // Initialize board

        // Display TI Logo
        LCD_drawPicture(1);
        TA1_sleep(8192);         // 2s
        TA1_sleep(8192);         // 2s
        // Write Title Screen on LCD
        LCD_introWrite();
        TA1_sleep(8192);         // 2s
        TA1_sleep(8192);         // 2s
    }

    // Init CapTouch Sliders
    TI_CAPT_Init_Baseline(&slider0);             //slider0 is the left capacitive touch slider (note right slider is not used)
 //   TI_CAPT_Init_Baseline(&slider1);

    TI_CAPT_Update_Baseline(&slider0, 10);
 //   TI_CAPT_Update_Baseline(&slider1, 10);


    InitMCU(); //initialize MCU for BMS
    BMSstart(); //start the BMS by searching for BQ76PL536 chips and addressing them

    while (1) {
        // Choose which app to enter based on mode variable
        switch (mode) {
        case APP_MAIN_MENU:
            mode = MainMenu();                                      //start main menu
            break;
        case APP_CELL_VOLTAGE:
        	CellVoltApp();                                          //run the cell voltage app
            break;
        case APP_PACK_VOLTAGE:
        	LCD_displayPackVoltage();                               //displays pack voltage
            break;
        case APP_STATE_OF_CHARGE:                                   //run state of charge app
        	StateOfChargeApp();
            break;
        case APP_TEMPERATURE:                                       //display pack temperatures
        	LCD_displayTemperature();
            break;
        case APP_CELL_BALANCE:                                      //run cell balance app
            //CellBalanceApp();
        	LCD_displayCellsImbalanced();
            break;
        default: break;
        }
    }
}
Exemplo n.º 9
0
	virtual void Execute(LPCSTR args) {
		
#if 0
		if (!Level().autosave_manager().ready_for_autosave()) {
			Msg		("! Cannot save the game right now!");
			return;
		}
#endif
		if(!IsGameTypeSingle()){
			Msg("for single-mode only");
			return;
		}
		if(!g_actor || !Actor()->g_Alive())
		{
			Msg("cannot make saved game because actor is dead :(");
			return;
		}

		string_path				S,S1;
		S[0]					= 0;
//.		sscanf					(args ,"%s",S);
		strcpy_s					(S,args);
		
#ifdef DEBUG
		CTimer					timer;
		timer.Start				();
#endif
		if (!xr_strlen(S)){
			strconcat			(sizeof(S),S,Core.UserName,"_","quicksave");
			NET_Packet			net_packet;
			net_packet.w_begin	(M_SAVE_GAME);
			net_packet.w_stringZ(S);
			net_packet.w_u8		(0);
			Level().Send		(net_packet,net_flags(TRUE));
		}else{
			if(!valid_file_name(S)){
				Msg("invalid file name");
				return;
			}

			NET_Packet			net_packet;
			net_packet.w_begin	(M_SAVE_GAME);
			net_packet.w_stringZ(S);
			net_packet.w_u8		(1);
			Level().Send		(net_packet,net_flags(TRUE));
		}
#ifdef DEBUG
		Msg						("Game save overhead  : %f milliseconds",timer.GetElapsed_sec()*1000.f);
#endif
		SDrawStaticStruct* _s		= HUD().GetUI()->UIGame()->AddCustomStatic("game_saved", true);
		_s->m_endTime				= Device.fTimeGlobal+3.0f;// 3sec
		string_path					save_name;
		strconcat					(sizeof(save_name),save_name,*CStringTable().translate("st_game_saved"),": ", S);
		_s->wnd()->SetText			(save_name);

		strcat					(S,".dds");
		FS.update_path			(S1,"$game_saves$",S);
		
#ifdef DEBUG
		timer.Start				();
#endif
		MainMenu()->Screenshot		(IRender_interface::SM_FOR_GAMESAVE,S1);

#ifdef DEBUG
		Msg						("Screenshot overhead : %f milliseconds",timer.GetElapsed_sec()*1000.f);
#endif
	}
Exemplo n.º 10
0
	bool OnGossipSelect(Player *player, Creature * creature, uint32 sender, uint32 action)
	{
		player->PlayerTalkClass->ClearMenus();

		switch (action)	{
	
		case 100:	MainMenu(player, creature);	break;

	// Dos
		case 14:
			player->ADD_GOSSIP_ITEM(3, "70 armure", GOSSIP_SENDER_MAIN, 1412);
			player->ADD_GOSSIP_ITEM(3, "120 armure", GOSSIP_SENDER_MAIN, 1407);
			player->ADD_GOSSIP_ITEM(3, "5 résistances", GOSSIP_SENDER_MAIN, 1413);
			player->ADD_GOSSIP_ITEM(3, "7 résistances", GOSSIP_SENDER_MAIN, 1408);
			player->ADD_GOSSIP_ITEM(3, "12 agilité", GOSSIP_SENDER_MAIN, 1401);
			player->ADD_GOSSIP_ITEM(3, "12 esquive", GOSSIP_SENDER_MAIN, 1406);
			player->ADD_GOSSIP_ITEM(3, "12 défense", GOSSIP_SENDER_MAIN, 1411);
			player->ADD_GOSSIP_ITEM(3, "20 pénétration des sorts", GOSSIP_SENDER_MAIN, 1409);
			player->ADD_GOSSIP_ITEM(3, "10 résistance ombre", GOSSIP_SENDER_MAIN, 1404);
			player->ADD_GOSSIP_ITEM(3, "15 résistance ombre", GOSSIP_SENDER_MAIN, 1403);
			player->ADD_GOSSIP_ITEM(3, "15 résistance feu", GOSSIP_SENDER_MAIN, 1405);
			player->ADD_GOSSIP_ITEM(3, "15 résistance arcane", GOSSIP_SENDER_MAIN, 1410);
			player->ADD_GOSSIP_ITEM(3, "15 résistance nature", GOSSIP_SENDER_MAIN, 1400);
			player->ADD_GOSSIP_ITEM(3, "camouflage", GOSSIP_SENDER_MAIN, 1402);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20004, creature->GetGUID());
			break;
		case 1400:	Ench(player, creature, 14, 1395, 0, 0, 0);	break;
		case 1401:	Ench(player, creature, 14, 368, 0, 1, 0);	break;
		case 1402:	Ench(player, creature, 14, 910, 0, 0, 0);	break;
		case 1403:	Ench(player, creature, 14, 1441, 0, 1, 0);	break;
		case 1404:	Ench(player, creature, 14, 804, 0, 0, 0);	break;
		case 1405:	Ench(player, creature, 14, 1349, 0, 0, 0);	break;
		case 1406:	Ench(player, creature, 14, 2078, 0, 0, 0);	break;
		case 1407:	Ench(player, creature, 14, 2662, 0, 1, 0);	break;
		case 1408:	Ench(player, creature, 14, 2663, 0, 1, 0);	break;
		case 1409:	Ench(player, creature, 14, 2780, 0, 1, 0);	break;
		case 1410:	Ench(player, creature, 14, 1257, 0, 1, 0);	break;
		case 1411:	Ench(player, creature, 14, 1943, 0, 1, 0);	break;
		case 1412:	Ench(player, creature, 14, 1889, 0, 0, 0);	break;
		case 1413:	Ench(player, creature, 14, 1888, 0, 0, 0);	break;
		
	// Torse
		case 4:
			player->ADD_GOSSIP_ITEM(3, "100 vie", GOSSIP_SENDER_MAIN, 402);
			player->ADD_GOSSIP_ITEM(3, "100 mana", GOSSIP_SENDER_MAIN, 403);
			player->ADD_GOSSIP_ITEM(3, "150 vie", GOSSIP_SENDER_MAIN, 401);
			player->ADD_GOSSIP_ITEM(3, "4 caracteristiques", GOSSIP_SENDER_MAIN, 404);
			player->ADD_GOSSIP_ITEM(3, "6 caracteristiques", GOSSIP_SENDER_MAIN, 400);
			player->ADD_GOSSIP_ITEM(3, "7 mana par 5 secondes", GOSSIP_SENDER_MAIN, 405);
			player->ADD_GOSSIP_ITEM(3, "15 résilience", GOSSIP_SENDER_MAIN, 406);
			player->ADD_GOSSIP_ITEM(3, "15 esprit", GOSSIP_SENDER_MAIN, 407);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20005, creature->GetGUID());
			break;
		case 400:	Ench(player, creature, 4, 2661, 0, 1, 0);	break;
		case 401:	Ench(player, creature, 4, 2659, 0, 1, 0);	break;
		case 402:	Ench(player, creature, 4, 1892, 0, 0, 0);	break;
		case 403:	Ench(player, creature, 4, 1893, 0, 0, 0);	break;
		case 404:	Ench(player, creature, 4, 1891, 0, 0, 0);	break;
		case 405:	Ench(player, creature, 4, 2852, 0, 1, 0);	break;
		case 406:	Ench(player, creature, 4, 2789, 0, 1, 0);	break;
		case 407:	Ench(player, creature, 4, 1144, 0, 1, 0);	break;
	  
	// Bras
		case 8:
			player->ADD_GOSSIP_ITEM(3, "12 endurance", GOSSIP_SENDER_MAIN, 805);
			player->ADD_GOSSIP_ITEM(3, "12 intelligence", GOSSIP_SENDER_MAIN, 806);
			player->ADD_GOSSIP_ITEM(3, "12 force", GOSSIP_SENDER_MAIN, 801);
			player->ADD_GOSSIP_ITEM(3, "24 puissance d'attaque", GOSSIP_SENDER_MAIN, 807);
			player->ADD_GOSSIP_ITEM(3, "15 puissance des sorts", GOSSIP_SENDER_MAIN, 800);
			player->ADD_GOSSIP_ITEM(3, "4 caracteristiques", GOSSIP_SENDER_MAIN, 802);
			player->ADD_GOSSIP_ITEM(3, "9 esprit", GOSSIP_SENDER_MAIN, 808);
			player->ADD_GOSSIP_ITEM(3, "12 défense", GOSSIP_SENDER_MAIN, 803);
			player->ADD_GOSSIP_ITEM(3, "8 mana par les 5 secondes", GOSSIP_SENDER_MAIN, 804);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20006, creature->GetGUID());
			break;
		case 800:	Ench(player, creature, 8, 2319, 0, 0, 0);	break;
		case 801:	Ench(player, creature, 8, 372, 0, 1, 0);	break;
		case 802:	Ench(player, creature, 8, 1891, 0, 1, 0);	break;
		case 803:	Ench(player, creature, 8, 1943, 0, 1, 0);	break;
		case 804:	Ench(player, creature, 8, 2382, 0, 1, 0);	break;
		case 805:	Ench(player, creature, 8, 371, 0, 1, 0);	break;
		case 806:	Ench(player, creature, 8, 369, 0, 1, 0);	break;
		case 807:	Ench(player, creature, 8, 1593, 0, 1, 0);	break;
		case 808:	Ench(player, creature, 8, 355, 0, 0, 0);	break;
	
	// Mains
		case 9:
			player->ADD_GOSSIP_ITEM(3, "15 force", GOSSIP_SENDER_MAIN, 904);
			player->ADD_GOSSIP_ITEM(3, "15 agilité", GOSSIP_SENDER_MAIN, 901);
			player->ADD_GOSSIP_ITEM(3, "15 toucher", GOSSIP_SENDER_MAIN, 903);
			player->ADD_GOSSIP_ITEM(3, "10 critique", GOSSIP_SENDER_MAIN, 902);
			player->ADD_GOSSIP_ITEM(3, "26 puissance d'attaque", GOSSIP_SENDER_MAIN, 905);
			player->ADD_GOSSIP_ITEM(3, "20 puissance des sorts", GOSSIP_SENDER_MAIN, 906);
			player->ADD_GOSSIP_ITEM(3, "10 hâte", GOSSIP_SENDER_MAIN, 907);
			player->ADD_GOSSIP_ITEM(3, "2% vitesse monture", GOSSIP_SENDER_MAIN, 908);
			player->ADD_GOSSIP_ITEM(3, "5 pêche", GOSSIP_SENDER_MAIN, 900);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20007, creature->GetGUID());
			break;
		case 900:	Ench(player, creature, 9, 846, 0, 0, 0);	break;
		case 901:	Ench(player, creature, 9, 883, 0, 0, 0);	break;
		case 902:	Ench(player, creature, 9, 2934, 0, 1, 0);	break;
		case 903:	Ench(player, creature, 9, 2935, 0, 1, 0);	break;
		case 904:	Ench(player, creature, 9, 684, 0, 1, 0);	break;
		case 905:	Ench(player, creature, 9, 1594, 0, 1, 0);	break;
		case 906:	Ench(player, creature, 9, 2323, 0, 1, 0);	break;
		case 907:	Ench(player, creature, 9, 931, 0, 0, 0);	break;
		case 908:	Ench(player, creature, 9, 930, 0, 0, 0);	break;
	
		// Jambes
		case 6:	Ench(player, creature, 6, 18, 0, 0, 0);	break;
 
		case 7: // Bottes
			player->ADD_GOSSIP_ITEM(3, "12 endurance", GOSSIP_SENDER_MAIN, 701);
			player->ADD_GOSSIP_ITEM(3, "12 agilité", GOSSIP_SENDER_MAIN, 704);
			player->ADD_GOSSIP_ITEM(3, "9 endurance + vitesse mineur", GOSSIP_SENDER_MAIN, 703);
			player->ADD_GOSSIP_ITEM(3, "6 agilité + vitesse mineur", GOSSIP_SENDER_MAIN, 705);
			player->ADD_GOSSIP_ITEM(3, "5 vie et mana par 5 secondes", GOSSIP_SENDER_MAIN, 700);
			player->ADD_GOSSIP_ITEM(3, "10 toucher et critique", GOSSIP_SENDER_MAIN, 702);
			player->ADD_GOSSIP_ITEM(3, "5 toucher", GOSSIP_SENDER_MAIN, 706);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20008, creature->GetGUID());
			break;
		case 700:	Ench(player, creature, 7, 2656, 0, 1, 0);	break;
		case 701:	Ench(player, creature, 7, 371, 0, 1, 0);	break;
		case 702:	Ench(player, creature, 7, 2658, 0, 1, 0);	break;
		case 703:	Ench(player, creature, 7, 2940, 0, 1, 0);	break;
		case 704:	Ench(player, creature, 7, 368, 0, 1, 0);	break;
		case 705:	Ench(player, creature, 7, 2939, 0, 1, 0);	break;
		case 706:	Ench(player, creature, 7, 3858, 0, 0, 0);	break;
			
	// Armes
		case 15:	player->SetClmSlotid(15);	goto l16;	break;
		case 16:	player->SetClmSlotid(16);	l16:
		case 153:	player->SetClmSlty(1);
			player->ADD_GOSSIP_ITEM(0, "=> Page 2", GOSSIP_SENDER_MAIN, 154);
			player->ADD_GOSSIP_ITEM(3, "15 force", GOSSIP_SENDER_MAIN, 1502);
			player->ADD_GOSSIP_ITEM(3, "20 force", GOSSIP_SENDER_MAIN, 1508);
			player->ADD_GOSSIP_ITEM(3, "15 agilité", GOSSIP_SENDER_MAIN, 1503);
			player->ADD_GOSSIP_ITEM(3, "20 agilité", GOSSIP_SENDER_MAIN, 1517);
			player->ADD_GOSSIP_ITEM(3, "20 esprit", GOSSIP_SENDER_MAIN, 1504);
			player->ADD_GOSSIP_ITEM(3, "22 intelligence", GOSSIP_SENDER_MAIN, 1505);
			player->ADD_GOSSIP_ITEM(3, "30 intelligence", GOSSIP_SENDER_MAIN, 1507);
			player->ADD_GOSSIP_ITEM(3, "29 puissance des sorts", GOSSIP_SENDER_MAIN, 1516);
			player->ADD_GOSSIP_ITEM(3, "30 puissance des sorts", GOSSIP_SENDER_MAIN, 1501);
			player->ADD_GOSSIP_ITEM(3, "40 puissance des sorts (jaune)", GOSSIP_SENDER_MAIN, 1515);
			player->ADD_GOSSIP_ITEM(3, "40 puissance des sorts (blanc)", GOSSIP_SENDER_MAIN, 1509);
			player->ADD_GOSSIP_ITEM(3, "50 feu et arcanes", GOSSIP_SENDER_MAIN, 1510);
			player->ADD_GOSSIP_ITEM(3, "54 givre et ombre", GOSSIP_SENDER_MAIN, 1511);
			player->ADD_GOSSIP_ITEM(3, "5 dégâts de l'arme", GOSSIP_SENDER_MAIN, 1521);
			player->ADD_GOSSIP_ITEM(3, "7 dégâts de l'arme", GOSSIP_SENDER_MAIN, 1506);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20009, creature->GetGUID());
			break;
		case 154:
			player->ADD_GOSSIP_ITEM(0, "Page 1 <=", GOSSIP_SENDER_MAIN, 153);
			player->ADD_GOSSIP_ITEM(3, "Croisé", GOSSIP_SENDER_MAIN, 1500);
			player->ADD_GOSSIP_ITEM(3, "Vol-de-vie", GOSSIP_SENDER_MAIN, 1518);
			player->ADD_GOSSIP_ITEM(3, "Impie", GOSSIP_SENDER_MAIN, 1519);
			player->ADD_GOSSIP_ITEM(3, "Flamboyante", GOSSIP_SENDER_MAIN, 1520);
			player->ADD_GOSSIP_ITEM(3, "Frisson glacial", GOSSIP_SENDER_MAIN, 1522);
			player->ADD_GOSSIP_ITEM(3, "Tueur de démons", GOSSIP_SENDER_MAIN, 1523);
			player->ADD_GOSSIP_ITEM(3, "Mangouste", GOSSIP_SENDER_MAIN, 1512);
			player->ADD_GOSSIP_ITEM(3, "Eruption de sort", GOSSIP_SENDER_MAIN, 1513);
			player->ADD_GOSSIP_ITEM(3, "Maître de guerre", GOSSIP_SENDER_MAIN, 1514);
			player->ADD_GOSSIP_ITEM(3, "2M - 25 agilité", GOSSIP_SENDER_MAIN, 1524);
			player->ADD_GOSSIP_ITEM(3, "2M - 70 puissance d'attaque", GOSSIP_SENDER_MAIN, 1525);
			player->ADD_GOSSIP_ITEM(3, "2M - 35 agilité", GOSSIP_SENDER_MAIN, 1526);
			player->ADD_GOSSIP_ITEM(3, "2M - 9 dégâts de l'arme", GOSSIP_SENDER_MAIN, 1527);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20009, creature->GetGUID());
			break;
	// 1M
		case 1500:	Ench(player, creature, player->GetClmSlotid(), 1900, 0, 0, player->GetClmSlty());	break;
		case 1501:	Ench(player, creature, player->GetClmSlotid(), 2504, 0, 0, player->GetClmSlty());	break;
		case 1502:	Ench(player, creature, player->GetClmSlotid(), 2563, 0, 0, player->GetClmSlty());	break;
		case 1503:	Ench(player, creature, player->GetClmSlotid(), 2564, 0, 0, player->GetClmSlty());	break;
		case 1504:	Ench(player, creature, player->GetClmSlotid(), 2567, 0, 0, player->GetClmSlty());	break;
		case 1505:	Ench(player, creature, player->GetClmSlotid(), 2568, 0, 0, player->GetClmSlty());	break;
		case 1506:	Ench(player, creature, player->GetClmSlotid(), 120, 0, 1, player->GetClmSlty());	break;
		case 1507:	Ench(player, creature, player->GetClmSlotid(), 2666, 0, 1, player->GetClmSlty());	break;
		case 1508:	Ench(player, creature, player->GetClmSlotid(), 2668, 0, 1, player->GetClmSlty());	break;
		case 1509:	Ench(player, creature, player->GetClmSlotid(), 2669, 0, 1, player->GetClmSlty());	break;
		case 1510:	Ench(player, creature, player->GetClmSlotid(), 2671, 0, 1, player->GetClmSlty());	break;
		case 1511:	Ench(player, creature, player->GetClmSlotid(), 2672, 0, 1, player->GetClmSlty());	break;
		case 1512:	Ench(player, creature, player->GetClmSlotid(), 2673, 0, 1, player->GetClmSlty());	break;
		case 1513:	Ench(player, creature, player->GetClmSlotid(), 2674, 0, 1, player->GetClmSlty());	break;
		case 1514:	Ench(player, creature, player->GetClmSlotid(), 2675, 0, 1, player->GetClmSlty());	break;
		case 1515:	Ench(player, creature, player->GetClmSlotid(), 3846, 0, 1, player->GetClmSlty());	break;
		case 1516:	Ench(player, creature, player->GetClmSlotid(), 2505, 0, 0, player->GetClmSlty());	break;
		case 1517:	Ench(player, creature, player->GetClmSlotid(), 3222, 0, 1, player->GetClmSlty());	break;
		case 1518:	Ench(player, creature, player->GetClmSlotid(), 1898, 0, 0, player->GetClmSlty());	break;
		case 1519:	Ench(player, creature, player->GetClmSlotid(), 1899, 0, 0, player->GetClmSlty());	break;
		case 1520:	Ench(player, creature, player->GetClmSlotid(), 803, 0, 0, player->GetClmSlty());	break;
		case 1521:	Ench(player, creature, player->GetClmSlotid(), 118, 0, 0, player->GetClmSlty());	break;
		case 1522:	Ench(player, creature, player->GetClmSlotid(), 1894, 0, 0, player->GetClmSlty());	break;
		case 1523:	Ench(player, creature, player->GetClmSlotid(), 912, 0, 0, player->GetClmSlty());	break;
	// 2M
		case 1524:	Ench(player, creature, player->GetClmSlotid(), 2646, 1, 0, player->GetClmSlty());	break;
		case 1525:	Ench(player, creature, player->GetClmSlotid(), 2667, 1, 1, player->GetClmSlty());	break;
		case 1526:	Ench(player, creature, player->GetClmSlotid(), 2670, 1, 1, player->GetClmSlty());	break;
		case 1527:	Ench(player, creature, player->GetClmSlotid(), 1895, 1, 0, player->GetClmSlty());	break;

		case 18: // Boucliers
			player->ADD_GOSSIP_ITEM(3, "18 endurance", GOSSIP_SENDER_MAIN, 1803);
			player->ADD_GOSSIP_ITEM(3, "12 inteligence", GOSSIP_SENDER_MAIN, 1804);
			player->ADD_GOSSIP_ITEM(3, "12 résilience", GOSSIP_SENDER_MAIN, 1800);
			player->ADD_GOSSIP_ITEM(3, "36 valeur de blacage", GOSSIP_SENDER_MAIN, 1801);
			player->ADD_GOSSIP_ITEM(3, "15 score de blocage", GOSSIP_SENDER_MAIN, 1802);
			player->ADD_GOSSIP_ITEM(3, "5 à toutes les résistances", GOSSIP_SENDER_MAIN, 1805);
			player->ADD_GOSSIP_ITEM(0, "=> Retour", GOSSIP_SENDER_MAIN, 100);
			player->SEND_GOSSIP_MENU(20010, creature->GetGUID());
			break;
		case 1800:	Ench(player, creature, 16, 3229, 0, 1, player->GetClmSlty());	break;
		case 1801:	Ench(player, creature, 16, 2653, 0, 1, player->GetClmSlty());	break;
		case 1802:	Ench(player, creature, 16, 1985, 0, 1, player->GetClmSlty());	break;
		case 1803:	Ench(player, creature, 16, 1071, 0, 1, player->GetClmSlty());	break;
		case 1804:	Ench(player, creature, 16, 2654, 0, 1, player->GetClmSlty());	break;
		case 1805:	Ench(player, creature, 16, 1888, 0, 1, player->GetClmSlty());	break;

	// Ranged
		case 17:	Ench(player, creature, 17, 663, 0, 0, 0);	break;
		}
		return true;
	}
Exemplo n.º 11
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  long wdata;

  switch (message)
    {

    case WM_ERASEBKGND:
      return TRUE; // JMW trying to reduce screen flicker
      break;
    case WM_COMMAND:
      return MainMenu(hWnd, message, wParam, lParam);
      break;
    case WM_CTLCOLORSTATIC:
      wdata = GetWindowLong((HWND)lParam, GWL_USERDATA);
      switch(wdata) {
      case 0:
        SetBkColor((HDC)wParam, ColorUnselected);
        SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00));
        return (LRESULT)hBrushUnselected;
      case 1:
        SetBkColor((HDC)wParam, ColorSelected);
        SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00));
        return (LRESULT)hBrushSelected;
      case 2:
	SetBkColor((HDC)wParam, ColorUnselected);
        SetTextColor((HDC)wParam, ColorWarning);
	return (LRESULT)hBrushUnselected;
      case 3:
	SetBkColor((HDC)wParam, ColorUnselected);
        SetTextColor((HDC)wParam, ColorOK);
	return (LRESULT)hBrushUnselected;
      case 4:
	// black on light green
        SetTextColor((HDC)wParam, RGB_BLACK); 
	SetBkColor((HDC)wParam, ColorButton);
	return (LRESULT)hBrushButton;
      case 5:
	// grey on light green
	SetBkColor((HDC)wParam, ColorButton);
        SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80));
	return (LRESULT)hBrushButton;
#ifdef LXMINIMAP
      case 6:
        // black on dark yellow
        SetTextColor((HDC)wParam, RGB_BLACK);
        SetBkColor((HDC)wParam, ColorButtonHasFocus);
        return (LRESULT)hBrushButtonHasFocus;
      case 7:
        // grey on dark yellow
        SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80));
        SetBkColor((HDC)wParam, ColorButtonHasFocus);
        return (LRESULT)hBrushButtonHasFocus;
#endif

      }
      break;
    case WM_CREATE:
#ifdef HAVE_ACTIVATE_INFO
      memset (&s_sai, 0, sizeof (s_sai));
      s_sai.cbSize = sizeof (s_sai);
#endif
      if (iTimerID == 0) {
        iTimerID = SetTimer(hWnd,1000,500,NULL); // 500ms  2 times per second
      }

      break;

    case WM_ACTIVATE:

      if(LOWORD(wParam) != WA_INACTIVE)
        {
          SetWindowPos(hWndMainWindow,HWND_TOP,
                 0, 0, 0, 0,
                 SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);

#ifdef HAVE_ACTIVATE_INFO
         SHFullScreen(hWndMainWindow,SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON|SHFS_HIDESTARTICON);
#endif

        }
#ifdef HAVE_ACTIVATE_INFO
      if (api_has_SHHandleWMActivate) {
        SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
      } else {
        #ifdef TESTBENCH
        StartupStore(TEXT("... SHHandleWMActivate not available%s"),NEWLINE);
        #endif
        return DefWindowProc(hWnd, message, wParam, lParam);
      }
#endif
      break;

    case WM_SETTINGCHANGE:
#ifdef HAVE_ACTIVATE_INFO
      if (api_has_SHHandleWMSettingChange) {
        SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
      } else {
        #ifdef TESTBENCH
        StartupStore(TEXT("... SHHandleWMSettingChange not available%s"),NEWLINE);
        #endif
        return DefWindowProc(hWnd, message, wParam, lParam);
      }
#endif
      break;

	#if DEBUG_FOCUS
    case WM_KILLFOCUS:
	// This is happening when focus is given to another window, either internally inside LK
	// or externally, for example to explorer..
	// SO: if we select MapWindow, we get here a KILLFOCUS from it.
	// When we select another process/program, or click on the desktop, the old window having focus is
	// receiving KILLFOCUS. So in case MapWindow was working, the signal will be sent over there, not here.
	// 
	StartupStore(_T("............ WNDPROC LOST FOCUS (KILLFOCUS)\n"));
	break;
	#endif

    case WM_SETFOCUS:
	// When explorer/desktop is giving focus to LK, this is where we get the signal.
	// But we must return focus to previous windows otherwise keys will not be working.
	// Mouse is another story, because mouse click is pertinent to a screen area which is mapped.
	// A mouse click will be sent to the window in the background, whose handler will receive the event.
	//
	// Each event handler receiving focus has to save it in hWndWithFocus, in LK.
	// Each event handler must thus handle SETFOCUS!
	//
	#if DEBUG_FOCUS
	StartupStore(_T("............ WNDPROC HAS FOCUS  (SETFOCUS)\n"));
	if (hWndWithFocus==NULL)
		StartupStore(_T(".....(no Wnd to give focus to)\n"));
	else
		StartupStore(_T(".....(passing focus to other window)\n"));
	#endif
	if (hWndWithFocus!=NULL) SetFocus(hWndWithFocus);
      break;

    case WM_KEYUP:
      break;

    case WM_TIMER:
	// WM_TIMER is run at about 2hz.
	LKHearthBeats++; // 100213
      //      ASSERT(hWnd==hWndMainWindow);
      if (ProgramStarted > psInitInProgress) {
	if (SIMMODE)
		SIMProcessTimer();
	else
		ProcessTimer();
	if (ProgramStarted==psFirstDrawDone) {
	  AfterStartup();
	  ProgramStarted = psNormalOp;
          StartupStore(_T(". ProgramStarted=NormalOp %s%s"), WhatTimeIsIt(),NEWLINE);
          StartupLogFreeRamAndStorage();

	}
      }
      break;

    case WM_INITMENUPOPUP:
      if (ProgramStarted > psInitInProgress) {
	  CheckMenuItem((HMENU) wParam,IDM_FILE_LOCK,MF_CHECKED|MF_BYCOMMAND);
	
	if(LoggerActive)
	  CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_CHECKED|MF_BYCOMMAND);
	else
	  CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_UNCHECKED|MF_BYCOMMAND);
      }
      break;

    case WM_CLOSE:

      LKASSERT(hWnd==hWndMainWindow);
      if((hWnd==hWndMainWindow) && 
         (MessageBoxX(hWndMainWindow,
		// LKTOKEN  _@M198_ = "Confirm Exit?"
               	gettext(TEXT("_@M198_")),
                      TEXT("LK8000"),
                      MB_YESNO|MB_ICONQUESTION) == IDYES)) 
        {
          if(iTimerID) {
            KillTimer(hWnd,iTimerID);
            iTimerID = 0;
          }

          Shutdown();
        }
      break;

    case WM_DESTROY:
      if (hWnd==hWndMainWindow) {
        PostQuitMessage(0);
      }
      break;

    default:
      return DefWindowProc(hWnd, message, wParam, lParam);
    }
  return 0;
}
Exemplo n.º 12
0
//------------------------------------------------------------------------------------
// прорисовка меню
//------------------------------------------------------------------------------------
void DrawMenu()
{

	// делаем плавное появление меню
	if (NeedShowMenu)
	{
		MenuContentTransp = 2.4f*(vw_GetTime()-LastMenuUpdateTime);
		if (MenuContentTransp >= 1.0f)
		{
			MenuContentTransp = 1.0f;
			NeedShowMenu = false;
			LastMenuUpdateTime = vw_GetTime();

			// выводим подсказку, если нужно
			if (GameStatus == PROFILE)
				if (Setup.NeedShowHint[0]) SetCurrentDialogBox(9);
			if (GameStatus == WORKSHOP)
			{
				if (CurrentWorkshop == 1)
					if (Setup.NeedShowHint[1]) SetCurrentDialogBox(10);
				if (CurrentWorkshop == 2)
					if (Setup.NeedShowHint[2]) SetCurrentDialogBox(11);
				if (CurrentWorkshop == 3)
					if (Setup.NeedShowHint[3]) SetCurrentDialogBox(12);
			}
			if (GameStatus == MISSION)
			{
				// проверяем, если в одном из профайлов уже открыли 3 миссии - выводим хинт с пожертвованием
				bool NeedShowDonate = false;
				for (int i=0; i<5; i++)
				{
					if (Setup.Profile[i].Used)
						if (Setup.Profile[i].ByMissionExperience[2] > 0) NeedShowDonate = true;
				}

				if (NeedShowDonate)
					if (Setup.NeedShowHint[6]) SetCurrentDialogBox(15);
			}

		}
	}

	// делаем полавное угасание меню
	if (NeedHideMenu)
	{
		MenuContentTransp = 1.0f - 2.4f*(vw_GetTime() - LastMenuUpdateTime);
		if (MenuContentTransp <= 0.0f)
		{
			MenuContentTransp = 0.0f;
			SetMenu2(NextMenu);
			LastMenuUpdateTime = vw_GetTime();
			NeedShowMenu = true;
			NeedHideMenu = false;
		}
	}


	vw_SetCameraMoveAroundPoint(VECTOR3D(0,0,0), 0.0f, VECTOR3D(0.0f, 0.0f, 0.0f));
	vw_CameraLookAt();




	// всегда первым рисуем скайбокс и "далекое" окружение
	StarSystemUpdate();
	StarSystemDraw(1);




	// рисуем название игры, чтобы звезды и корабли пролетали перед ним
	vw_Start2DMode(-1,1);
	// надпись AstroMenace
	RECT SrcRect, DstRect;
	SetRect(&SrcRect,0,0,863,128 );
	int StartX = (Setup.iAspectRatioWidth - 863)/2;
	SetRect(&DstRect,StartX,10,StartX+863,10+128);

	if (GameStatus != WORKSHOP &&
		GameStatus != INFORMATION &&
		GameStatus != INTERFACE &&
		GameStatus != OPTIONS &&
		GameStatus != CONFCONTROL &&
		GameStatus != OPTIONS_ADVANCED)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/astromenace.tga"),
			true, MenuContentTransp, 0.0f, RI_UL_CORNER, 1.0f, 1.0f, 1.0f);
	}

	vw_End2DMode();



	// рисуем все 3д объекты
	DrawAllObject3D(1);



	// после полной прорисовки делаем обновление данных
	UpdateAllObject3D(vw_GetTime());
	vw_UpdateAllParticleSystems(vw_GetTime());




	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// работаем со скриптом, пока он есть
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	if (Script != 0)
	if (!Script->Update(vw_GetTime()))
	{
		// удаляем скрипт
		delete Script; Script = 0;
	}





	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// переходим в 2д режим для прорисовки всех 2д частей
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	vw_Start2DMode(-1,1);




	switch(GameStatus)
	{
		case MAIN_MENU:		MainMenu(); break;
		case TOP_SCORES:	TopScoresMenu(); break;
		case INTERFACE:		InterfaceMenu(MenuContentTransp, &Button10Transp, &LastButton10UpdateTime); break;
		case OPTIONS:		OptionsMenu(MenuContentTransp, &Button10Transp, &LastButton10UpdateTime, &Button11Transp, &LastButton11UpdateTime); break;
		case OPTIONS_ADVANCED: OptionsAdvMenu(MenuContentTransp, &Button10Transp, &LastButton10UpdateTime, &Button11Transp, &LastButton11UpdateTime); break;
		case INFORMATION:	InformationMenu(); break;
		case CREDITS:		CreditsMenu(); break;
		case CONFCONTROL:	ConfControlMenu(MenuContentTransp, &Button10Transp, &LastButton10UpdateTime); break;
		case PROFILE:		ProfileMenu(); break;
		case DIFFICULTY:	DifficultyMenu(); break;
		case MISSION:		MissionMenu(); break;
		case WORKSHOP:		WorkshopMenu(); break;

		default:
			break;
	}




	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// последнее - вывод версии и копирайта
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

	// Version
	vw_DrawFont(6, 740, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.99f, "%s %s %s %i", vw_GetText("11_Version"), GAME_VERSION, vw_GetText("11_build"), GAME_BUILD);

	// Copyright
	int CSize = vw_FontSize("%s © 2007-2013, Viewizard", vw_GetText("11_Copyright"));
	vw_DrawFont(Setup.iAspectRatioWidth-7-CSize, 740, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.99f, "%s © 2007-2013, Viewizard", vw_GetText("11_Copyright"));




	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// завершение прорисовки
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	vw_End2DMode();


	// если нужно - рисуем в окошке еще одном
	switch(GameStatus)
	{
		case INFORMATION:	InformationDrawObject(); break;

		default:
			break;
	}




	// черное затемнение, если нужно
	if (NeedOnMenu)
	{
		MenuBlackTransp = 1.0f - 2.4f*(vw_GetTime() - LastMenuOnOffUpdateTime);
		if (MenuBlackTransp <= 0.0f)
		{
			MenuBlackTransp = 0.0f;
			NeedOnMenu = false;
			LastMenuOnOffUpdateTime = vw_GetTime();
		}

		vw_Start2DMode(-1,1);

		SetRect(&SrcRect,0,0,2,2);
		SetRect(&DstRect,0,0,Setup.iAspectRatioWidth,768);
		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, MenuBlackTransp);

		vw_End2DMode();
	}

	// черное затемнение, если нужно
	if (NeedOffMenu)
	{
		MenuBlackTransp = 2.4f*(vw_GetTime() - LastMenuOnOffUpdateTime);
		if (MenuBlackTransp >= 1.0f)
		{
			MenuBlackTransp = 1.0f;
			NeedOffMenu = false;
			LastMenuOnOffUpdateTime = vw_GetTime();
			// переход на игру
			WorkshopDestroyData();
			ComBuffer = GAME;
		}

		vw_Start2DMode(-1,1);

		SetRect(&SrcRect,0,0,2,2);
		SetRect(&DstRect,0,0,Setup.iAspectRatioWidth,768);
		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, MenuBlackTransp);

		vw_End2DMode();
	}

}
Exemplo n.º 13
0
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpszArgs*/, int /*nWinMode*/)
{
    try
    {
        CoInitialize(NULL);
        AppInit(&Notify(), CPath(CPath::MODULE_DIRECTORY), __argc, __argv);
        if (!g_Lang->IsLanguageLoaded())
        {
            CLanguageSelector().Select();
        }

        //Create the main window with Menu
        WriteTrace(TraceUserInterface, TraceDebug, "Create Main Window");
        CMainGui  MainWindow(true, stdstr_f("Project64 %s", VER_FILE_VERSION_STR).c_str()), HiddenWindow(false);
        CMainMenu MainMenu(&MainWindow);
        g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
        Notify().SetMainWindow(&MainWindow);
        CSupportWindow SupportWindow;

        if (g_Settings->LoadStringVal(Cmd_RomFile).length() > 0)
        {
            MainWindow.Show(true);	//Show the main window
            //N64 ROM or 64DD Disk
            stdstr ext = CPath(g_Settings->LoadStringVal(Cmd_RomFile)).GetExtension();
            if (!(_stricmp(ext.c_str(), "ndd") == 0))
            {
                //File Extension is not *.ndd so it should be a N64 ROM
                CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
            }
            else
            {
                //Ext is *.ndd, so it should be a disk file.
                if (CN64System::RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str()))
                {
                    stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
                    if ((IPLROM.length() <= 0) || (!CN64System::RunFileImage(IPLROM.c_str())))
                    {

                        CPath FileName;
                        const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
                        if (FileName.SelectFile(NULL, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
                        {
                            CN64System::RunFileImage(FileName);
                        }
                    }
                }
            }
        }
        else
        {
            SupportWindow.Show(reinterpret_cast<HWND>(MainWindow.GetWindowHandle()));
            if (UISettingsLoadBool(RomBrowser_Enabled))
            {
                WriteTrace(TraceUserInterface, TraceDebug, "Show Rom Browser");
                //Display the rom browser
                MainWindow.ShowRomList();
                MainWindow.Show(true);	//Show the main window
                MainWindow.HighLightLastRom();
            }
            else
            {
                WriteTrace(TraceUserInterface, TraceDebug, "Show Main Window");
                MainWindow.Show(true);	//Show the main window
            }
        }

        //Process Messages till program is closed
        WriteTrace(TraceUserInterface, TraceDebug, "Entering Message Loop");
        MainWindow.ProcessAllMessages();
        WriteTrace(TraceUserInterface, TraceDebug, "Message Loop Finished");

        if (g_BaseSystem)
        {
            g_BaseSystem->CloseCpu();
            delete g_BaseSystem;
            g_BaseSystem = NULL;
        }
        WriteTrace(TraceUserInterface, TraceDebug, "System Closed");
    }
    catch (...)
    {
        WriteTrace(TraceUserInterface, TraceError, "Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__);
        MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str(), "Exception", MB_OK);
    }
    AppCleanup();
    CoUninitialize();
    return true;
}
Exemplo n.º 14
0
s32 main(s32 argc, const char* argv[])
{
    atexit(unload_modules);

    InitVideo(); // Initialize video
    SetupPads(); // Initialize input
#ifdef TOPORT
    InitAudio(); // Initialize audio
    fatInitDefault(); // Initialize file system
#endif
#ifdef TOPORT
    InitFreeType((u8*)font_ttf, font_ttf_size); // Initialize font system
    InitGUIThreads(); // Initialize GUI
    DefaultSettings();
    MainMenu(MENU_SETTINGS);
#endif

#ifdef PSL1GHT

    if(SysLoadModule(SYSMODULE_FS)!=0) return 0;
    else module_flag |=1;

    if(SysLoadModule(SYSMODULE_PNGDEC)!=0) return 0;
    else module_flag |=2;

#endif
    VideoModule * video = VideoModule::getVideoModule();

    InputPadModule * inpad = InputPadModule::getInputPadModule();

#ifdef PSL1GHT
    PngDatas png1;

    LoadPNG(&png1, (char *)"/dev_usb/PS3_GAME/ICON0.PNG");
#endif


    long frame = 0; // To keep track of how many frames we have rendered.

    int x = DEBUG_X, y = DEBUG_Y;


    // Ok, everything is setup. Now for the main loop.
    while(1) {
        char str [300];
        sprintf(str, "Pad number : %d, frame %d", (int) inpad->getPadNumber(),(int)frame);

        inpad->refreshPadConnections();
        // Check the pads.
        for( size_t i = 0; i < inpad->getPadNumber(); i++)
        {
            if( inpad->getPad(i)->isPressed( eAbsButUp) && y > 0)
                y--;
            if( inpad->getPad(i)->isPressed( eAbsButDown) && y < 1080)
                y++;
            if( inpad->getPad(i)->isPressed( eAbsButLeft) && x > 0)
                x--;
            if( inpad->getPad(i)->isPressed( eAbsButRight) && x > 0)
                x++;
            else if( inpad->getPad(i)->isPressed( eAbsButExecute))
                return 0;
        }
        sprintf(str, "Pad number : %d, frame %d", (int) inpad->getPadNumber(),(int)frame);

        video->waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer

#ifdef PSL1GHT
        drawFrame(video->getCurrentBuffer(), frame++); // Draw into the unused buffer

        if(png1.bmp_out) {
            video->displayBitmap( (u32 *)png1.bmp_out, png1.height, png1.width, png1.wpitch);
        }
#endif
        video->printf(x, y, str);

        video->flip(); // Flip buffer onto screen
    }

    return 0;
}
Exemplo n.º 15
0
void CUIWindow::SetPPMode()
{
	m_bPP					= true;
	MainMenu()->RegisterPPDraw	(this);
	Show					(false);
};
Exemplo n.º 16
0
void CGameGunHound::Loop()
{
	//-----------------------------------------
	//ハウンドメイン
	//-----------------------------------------

	if( m_bResetOK )
	{
		if( m_bResetPlease )
		{
			m_bResetPlease = gxFalse;
			m_sEndSeq = -1;
			ChangeGameSeq( enMainSeqGameEnd );
		}
		else if( CDashBoard::GetInstance()->IsMenuBar() )
		{
			m_bPauseFlag = gxTrue;
		}
		else
		{
			m_bPauseFlag = gxFalse;
		}

	}


	switch( m_GameSeq ){
	case enMainSeqInit:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		m_bBriefingRoot = gxTrue;
		m_bResetOK      = gxFalse;
		viiDbg::log("ハウンドシーケンス:enMainSeqInit");
		//SaveDataInit();
		//GameConfigLoad();
		m_bPauseFlag = gxFalse;
		ChangeGameSeq( enMainSeqStart );
		break;

	case enMainSeqStart:
		//-----------------------------------------
		//スコア初期化
		//-----------------------------------------
		m_bResetOK = gxFalse;
		viiDbg::log("ハウンドシーケンス:enMainSeqStart");

#ifdef _VII_DEBUG_
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		CDashBoard::GetInstance()->SetLogo(gxFalse);
		CDashBoard::GetInstance()->SetWallPaper(gxFalse);
		ChangeGameSeq( enMainSeqRestart );
#else
//		ChangeGameSeq( enMainSeqGameOpeningDemo );
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		CDashBoard::GetInstance()->SetLogo(gxFalse);
		CDashBoard::GetInstance()->SetWallPaper(gxFalse);
		ChangeGameSeq( enMainSeqGameTitle );
#endif
		break;

	case enMainSeqGameTitle:
		//-----------------------------------------
		//タイトルのシーケンス
		//-----------------------------------------
		UploadTexture();
		m_bResetOK = gxFalse;
		ChangeGameSeq( enMainSeqRestart );
		break;

	case enMainSeqRestart:
		//-----------------------------------------
		//リスタートのポイント
		//-----------------------------------------
		m_bResetOK = gxFalse;

		ResetClass();

#ifdef GX_DEBUG
		ChangeGameSeq( enMainSeqDebugMenu );
#else
		ChangeGameSeq( enMainSeqGameMainMenu );
#endif
		break;

	case enMainSeqGameMainMenu:
		//-----------------------------------------
		//メインメニューのシーケンス
		//-----------------------------------------
		m_bResetOK = gxTrue;
		CDashBoard::GetInstance()->SetMenuDisable(gxTrue);
		switch( MainMenu() ){
		case enMenuSeqBack:
		case enMenuSeqNext:
			g_StGameInfo.Reset();
			if( m_sMainMenuSelected == CMainMenu::enMainMenuOpening )
			{
				//オープニングへ
				ChangeGameSeq( enMainSeqGameOpeningDemo );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuDebug )
			{
				//デバッグモードへ
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				ChangeGameSeq( enMainSeqDebugMenu );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuEnding )
			{
				//エンディング
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				ChangeGameSeq( enMainSeqGameEndingDemo );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuStart )
			{
				//ゲームスタートへ
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				g_StGameInfo.m_bMessage = gxTrue;
				ChangeGameSeq( enMainSeqGameBriefing );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuTutorial )
			{
				//チュートリアルスタートへ
				g_StGameInfo.m_bMusic   = gxTrue;
				g_StGameInfo.m_bMessage = gxTrue;
				g_StGameInfo.m_bReplay  = gxFalse;
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeNormal;
				g_StGameInfo.PlayStage = enScenarioTutorial;
				StageSet();
				g_StGameInfo.PlayArea  = m_sSelectedStage;
				ChangeGameSeq( enMainSeqGameInit );
			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuMission )
			{
				//ゲームスタートへ
				CDashBoard::GetInstance()->SetIcon( enIconNone );
				g_StGameInfo.m_sGameMode = StGameInfo::enGameModeMission;
				g_StGameInfo.PlayStage   = m_sSelectedStage;//enScenarioTutorial;
				g_StGameInfo.PlayArea = 0;

				StageSet();

				ChangeGameSeq( enMainSeqGameInit );

			}
			else if( m_sMainMenuSelected == CMainMenu::enMainMenuExit )
			{
				//ゲーム終了
				ExitGame();
			}
			break;

		default:
			break;
		}
		break;

	case enMainSeqGameOpeningDemo:
		//-----------------------------------------
		//オープニングのシーケンス
		//-----------------------------------------
		m_bResetOK = gxFalse;
		if( AdvertiseDemo()  )
		{
			ChangeGameSeq( enMainSeqGameTitle );
		}
		break;

	case enMainSeqDebugMenu:
		//-----------------------------------------
		//デバッグメニュー
		//-----------------------------------------
		m_bResetOK = gxTrue;
		switch( DebugMenu() ) {
		case enMenuSeqBack:
			ChangeGameSeq( enMainSeqGameMainMenu );
			break;
		case enMenuSeqNext:
//			g_StGameInfo.Reset();
			g_StGameInfo.m_bMessage = gxTrue;
			g_StGameInfo.m_bMusic   = gxTrue;
			g_StGameInfo.m_bReplay  = gxFalse;
			ChangeGameSeq( enMainSeqGameInit );
			break;
		}
		break;

	case enMainSeqGameBriefing:
		g_StGameInfo.ContinueArea = 0;

		CCockpit::GetInstance()->SetHidden();
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		m_bResetOK = gxTrue;

		if( m_pSetUp == NULL )
		{
			//セットアップ画面を作る
			m_pSetUp = new CSetUp( -1 );//g_StGameInfo.PlayStage );
		}

		if( BriefingMain() )
		{
			//ステージ決定
			StageSet();
			m_bBriefingRoot = gxTrue;
			ChangeGameSeq( enMainSeqGameSetUp );
		}

		CockpitControl();
		break;

	case enMainSeqGameSetUp:
		CCockpit::GetInstance()->SetHidden();
		m_bResetOK = gxTrue;

		if( m_pSetUp->IsEnd() )
		{
			ChangeGameSeq( enMainSeqGameBefore );
		}

		CockpitControl();
		break;

	case enMainSeqGameBefore:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		CCockpit::GetInstance()->ReNew();
		CCockpit::GetInstance()->SetHidden();

		CockpitControl();

		m_bResetOK = gxTrue;

		if( !m_pSetUp->IsWait() )
		{
			//CCockpit::GetInstance()->Reset();
			viiMus::StopBGM( enSoundBgm1 );
			ChangeGameSeq( enMainSeqGameInit );
		}

		break;

	case enMainSeqGameInit:
		//-----------------------------------------
		//ゲーム初期化
		//-----------------------------------------
		CCockpit::GetInstance()->Destroy();
		CCockpit::GetInstance()->SetHidden();
		m_bResetOK = gxFalse;

		if( pGame ) delete pGame;
		pGame = new CGameManager();

		GameInit();

		pGame->init();

		CockpitControl();

		viiMus::Destroy();
		ChangeGameSeq( enMainSeqGameMain );
		break;

	case enMainSeqGameMain:
		//-----------------------------------------
		//ゲームメイン
		//-----------------------------------------
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		m_bResetOK = gxTrue;

		if( m_pSetUp )
		{
			m_bResetOK = gxFalse;

			m_pSetUp->Draw();

			if( m_pSetUp->GoDestroy() )
			{
				//----------------------------------------------
				//セットアップ終了
				//----------------------------------------------
				CCockpit::GetInstance()->Reset();
				delete m_pSetUp;
				m_pSetUp = NULL;
			}
		}

		if( !m_bGameStart && pGame->IsGameStart() )
		{
			m_bGameStart = gxTrue;
		}

		GameMain();

		if( pGame->IsStageClear() )
		{
			m_sEndSeq = pGame->GetNextSeq();	//m_sEndSeq = 1;	//次へ
			ChangeGameSeq( enMainSeqGameEnd );
		}
		else if( CCockpit::GetInstance()->IsGameOver() )
		{
			m_sEndSeq = enClearSeqContinue;
			ChangeGameSeq( enMainSeqGameEnd );
		}

		break;

	case enMainSeqGameEnd:
		//-----------------------------------------
		//ゲーム終了
		//-----------------------------------------
		m_bResetOK = gxFalse;

		GameEnd();

		if( pGame )
		{
			delete pGame;
			pGame = NULL;
		}

		if( !m_bBriefingRoot )
		{
			m_sEndSeq = 0;
		}

		CCockpit::GetInstance()->ReNew();

		if( m_sMainMenuSelected == CMainMenu::enMainMenuMission || m_sMainMenuSelected == CMainMenu::enMainMenuTutorial)
		{
			//---------------------------------------
			//ストーリーモード以外の時
			//---------------------------------------

			//スコアを加算する
			g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );

			//ミッションモードだった
			ChangeGameSeq( enMainSeqGameMainMenu );

			//チュートリアルモードだった
			ChangeGameSeq( enMainSeqGameMainMenu );

		}
		else if( m_sEndSeq == enClearSeqStageClear )
		{
#ifdef _TRIAL_VERSION_
			//タイトルに戻る
			g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
			ChangeGameSeq( enMainSeqRestart );
#else
			//ステージクリアだった
			g_StGameInfo.SetStageClear( g_StGameInfo.PlayStage );
			switch( g_StGameInfo.PlayStage ){
			case enScenarioJungle:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission2 );
				break;
			case enScenarioRiver:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission3 );
				break;
			case enScenarioMountain:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission4 );
				break;
			case enScenarioBase:
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemMission5 );
				break;
			}

			ChangeGameSeq( enMainSeqGameBriefing );
#endif
		}
		else if( m_sEndSeq == enClearSeqContinue )
		{
			//ステージ失敗だった(コンティニュールート)
			ChangeGameSeq( enMainSeqGameContinue );
		}
		else if( m_sEndSeq == enClearSeqGameOver )
		{
			//ゲームオーバーだった
			ChangeGameSeq( enMainSeqGameContinue );
		}
		else if( m_sEndSeq == enClearSeqEnding )
		{
			//エンディングだった
			g_StGameInfo.SetStageClear( g_StGameInfo.PlayStage );
			g_CHoundSaveData.UpdateHighScore( MISSION_ALLOVER_BONUS );

			Uint32 uScore = 0;

			//ゲームスコアを加算
			m_stEndingBonus.uAllScore = g_StGameInfo.m_uAllScore;

			//オールオーバーボーナスをコンティニュー回数で割る
			m_stEndingBonus.uContinueBonus = MISSION_ALLOVER_BONUS/(g_StGameInfo.m_sContinueCnt+1);
			m_stEndingBonus.uContinueBonus = m_stEndingBonus.uContinueBonus/10;
			m_stEndingBonus.uContinueBonus = m_stEndingBonus.uContinueBonus*10;


			//Trueエンディングの場合場合ボーナス
			m_stEndingBonus.uTrueEndBonus = 0;
			if( g_StGameInfo.m_bTrueEnd )
			{
				m_stEndingBonus.uTrueEndBonus = ENDING_TRUEVERSION_BONUS;
				g_CHoundSaveData.SetHiddenOpen( enHiddenItemViewEnding );
			}

			//ノーコンティニューだった場合2倍ボーナス
			if( g_StGameInfo.m_sContinueCnt == 0 )
			{
				m_stEndingBonus.uNoContinueBonus = m_stEndingBonus.uAllScore + m_stEndingBonus.uContinueBonus + m_stEndingBonus.uTrueEndBonus;
			}

			uScore =  m_stEndingBonus.uAllScore;
			uScore += m_stEndingBonus.uContinueBonus;
			uScore += m_stEndingBonus.uTrueEndBonus;
			uScore += m_stEndingBonus.uNoContinueBonus;

			m_stEndingBonus.uTotalScore = uScore;

			//スコアを加算する
			g_CHoundSaveData.UpdateHighScore( uScore );

			ChangeGameSeq( enMainSeqGameEndingDemo );
		}
		else
		{
			//リセットだった
/*
			if( m_bGameStart && m_sMainMenuSelected == CMainMenu::enMainMenuStart )
			{
				m_sResetCount = 120;
				ChangeGameSeq( enMainSeqResetInGame );
			}
			else
			{
				ChangeGameSeq( enMainSeqRestart );
			}
*/
			ChangeGameSeq( enMainSeqRestart );

		}
		break;

	case enMainSeqGameContinue:
		//-----------------------------------------
		//コンティニュー
		//-----------------------------------------
		m_bResetOK = gxTrue;
		m_bGameStart = gxFalse;
		switch( ContinueScreen() ){
		case enMenuSeqNext:
			{
				//タイトルに戻る
				g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
				ChangeGameSeq( enMainSeqRestart );
			}
			break;

		case enMenuSeqBack:
			{
				//コンティニューする
//				Sint32 sMem = g_StGameInfo.PlayArea;
//				StageSet();
				//スコアをリセットする
/*
				g_StGameInfo.m_uAllScore   = (g_StGameInfo.m_uAllScore/2);
				g_StGameInfo.m_uAllScore   -= g_StGameInfo.m_uAllScore%10;;
*/
				//スコア更新
				g_CHoundSaveData.UpdateHighScore( g_StGameInfo.m_uAllScore );
				g_StGameInfo.m_uAllScore   = 0;//(g_StGameInfo.m_uAllScore/2);
				g_StGameInfo.m_uStageScore = g_StGameInfo.m_uAllScore;

				if( g_StGameInfo.m_sContinueCnt < 99 ) g_StGameInfo.m_sContinueCnt ++;
				g_StGameInfo.ContinueArea = g_StGameInfo.PlayArea;
				ChangeGameSeq( enMainSeqGameInit );
			}
			break;

		default:
			break;
		}
		break;

	case enMainSeqGameEndingDemo:
		//-----------------------------------------
		//ゲーム終了
		//-----------------------------------------
		m_bResetOK = gxTrue;
		m_bGameStart = gxFalse;
		CCockpit::GetInstance()->SetHidden();
		CDashBoard::GetInstance()->SetMenuDisable(gxFalse);
		if( EndingDemo() )
		{
			ChangeGameSeq( enMainSeqRestart );
		}
		break;
	case enMainSeqResetInGame:
		if( m_sResetCount > 0 )
		{
			m_sResetCount --;
		}
		else
		{
			g_StGameInfo.m_uAllScore   = 0;
			g_StGameInfo.m_uStageScore = 0;
			g_StGameInfo.ContinueArea = g_StGameInfo.PlayArea;
			CCockpit::GetInstance()->ReNew();
			ChangeGameSeq( enMainSeqGameInit );
		}
		break;
	default:
		break;
	}

	viiMus::GetInstance()->Action();
	CFadeManager::GetInstance()->action();
}
Exemplo n.º 17
0
void MainProcessCommand(char cmd, char *qi){
	char buf[50];
	int iVal;
	char cVal;
	double dVal;
	int ch;


	switch(cmd){
		case 'h':
			MainMenu();
			break;

		case 'a' :
			ch = QueryInt("Analog Channel",0,16,ch,qi);
			printf("ch %d : %.4lf V\n", ch, HW->ReadAnalogCh((IoHardware::AnalogInputCh) ch));

			//HW->AnalogInAvgStart((IoHardware::AnalogInputCh) ch);
			sleep(1);
			//printf("ch %d : %.4lf V\n", ch, HW->AnalogInAvgGet());
			break;
		
		case 'g':
			SampleLoop->Kp = QueryReal("Value Kp",0.,10000.0,SampleLoop->Kp,qi);
			SampleLoop->Kd = QueryReal("Value Kd",0.,10000.0,SampleLoop->Kd,qi);
			SampleLoop->Ki = QueryReal("Value Ki",0.,10000.0,SampleLoop->Ki,qi);
			break;
		
		case 'o':
			printf("SampleLoop Overrun = %d\n", SampleLoop->mOverRun);
			break;
		
		case 't':
			dVal = QueryReal("Test duration [s]",0.,10000.0,10.,qi);
			SampleLoop->TimingStart(dVal);
			break;
			
		case 'c':
			SampleLoop->camera = !(SampleLoop->camera);
			if(SampleLoop->camera == 0) printf("camera is OFF.\n");
			else printf("camera is ON.\n");
			break;

		case 'm':
			if(HW->motorStatus == MOTOR_OFF){
				HW->WriteDigitalBit(IoHardware::MOTOR_ENABLE, MOTOR_ON);
				HW->motorStatus = MOTOR_ON;
				printf("motor is ON.\n");
			}
			else{
				HW->WriteDigitalBit(IoHardware::MOTOR_ENABLE, MOTOR_OFF);
				HW->motorStatus = MOTOR_OFF;
				printf("motor is OFF.\n");
			}
			break;

		case 'f':
			SampleLoop->currentI = QueryReal("Value iCmd",-0.1,0.1,SampleLoop->currentI,qi);
			break;

		case 'e':
			startpos = (HW->GetEncoderCount(IoHardware::ENC_0) % 100000 + 100000) % 100000;
			printf("set start encoder:%d\n",  startpos);
			break;

		case 's':
			if (setstartpos(startpos))
				printf("start position setted!\n");
			else 
				printf("Didn't get it..");
			break;

		case 'l':
			LEDtoggle = !LEDtoggle;
			if (LEDtoggle) SampleLoop->IRLEDdetect();
			break;

		default:
			printf("Bad command %c.  Try 'h'.\n", cmd);
	}

}
Exemplo n.º 18
0
int main()
{
	LoadDict(&M);
    	system("clear");
    	printf("%s=====================================================================\n", cyan);
    	printf(" _       ______  ____  ____  ___    __  __________   ________   ____ \n");
    	printf("| |     / / __ \\/ __ \\/ __ \\/   |  /  |/  / ____/ | / /_  __/  / __ \\ \n");
    	printf("| | /| / / / / / /_/ / / / / /| | / /|_/ / __/ /  |/ / / /    / / / /\n");
    	printf("| |/ |/ / /_/ / _ _ / /_/ / ___ |/ /  / / /___/ /|  / / /    / /_/ / \n");
    	printf("|__/|__/\\____/_/ |_/_____/_/  |_/_/  /_/_____/_/ |_/ /_/     \\____/  \n\n");
    	printf("=====================================================================\n\n\n");
    	printf("                      %sPress any key to continue%s\n",magenta,normal);
    	getch();
   	while(opt1 != 5)  //OPT1 = 5 adalah QUIT
	{
        MainMenu(&opt1);       // MENAMPILKAN MAIN MENU
        switch(opt1)
        {
            case 1 : 	// REGISTER
                printf("%sEnter user name : ", cyan);

                do
                {
                    found = false;	// INISIALISASI YANG MENANDAKAN USER BELUM DITEMUKAN DI FILE EKSTERNAL
                    scanf("%s", username.TabKata);
                    username.Length = strlen(username.TabKata); 
                    if(strlen(username.TabKata) >= 20 || !(IsAlNumS(username))) // MENGECEK APAKAH LEBIH DARI 20 ATAU ALFANUMERIK
                        printf("Username must be alphanumeric / less or equal to 20 characters\n");
                    else
                    {
                        *x = "scores/List Users & Highscores 2.txt";
                        STARTKATA();
                        while(!EndKata && !found)
                            CheckUser(username,&id,&found);

                        if(found)
                            printf("Sorry, that username already exists\n");
                    }
                }while((strlen(username.TabKata) >= 20 || !(IsAlNumS(username))) || found);
		
                SalinFile(LU,username);
                printf("Congratulations! %s has been successfully registered\n",username.TabKata);
                printf("\n");
                printf("%sPress any key to continue%s\n", magenta,cyan);
                dummygetch = getch();
		dummygetch = getch();
                break;

            case 2 :	//LOGIN			
                CreateList(&LU);
                printf("\n");
                *x = "scores/List Users & Highscores 2.txt";
                STARTKATA();
                while(!(EndKata))
                    InitUser(&LU,&id);	// MEMASUKKAN DATA FILE EKSTERNAL KE DALAM LIST
                InversListU(&LU);
                ListUsersLengkap(LU);	// MENAMPILKAN LIST USER
                found1 = false;		// INISIALISASI YANG MENANDAKAN USERNAME TIDAK DITEMUKAN
                while(!found1)
                {
                    printf("=====================================================================\n");
                    printf("Enter username : "******"%s",username1.TabKata);
                    username1.Length = strlen(username1.TabKata);
                    STARTKATA();
                    while(!EndKata && !found1)
                        CheckUser(username1,&id,&found1);

                    if(!found1)
                        printf("%s not found. Try again\n",username1.TabKata);
                }

                SelectB = true;	// INISIALISASI AGAR SETELAH MEMILIH BOARD, MELIHAT SCORE TIDAK KELUAR KE MAIN MENU, MELAINKAN PREP MENU
                selectT = false;	// INISIALISASI YANG MENANDAKAN USER BELUM PILIH BOARD
                
                while(SelectB == true)
                {
		    if(selectT == false)
			kode = 1;

                    PrepMenu(&opt2, username1);	// PREPARATION MENU
                    switch(opt2)
                    {
                        case 1 :	// PLAY GAME
                            if(selectT == false) 
			    {
                                kode = 1;
                                *y = "boards/1.txt";
                            }
                            baris = 1;
                            kolom = 1;
                            T = false;
                            used = false;
                            score = 0;
                            CreateEmptyQ(&QFinish);
                            CreateEmpty(&S);
							CreateListSU(&LSG);
							CreateListSU(&LSGTemp);
							
							ReadSuggestion(&LSG, kode);
							strcpy(tempsugg, username1.TabKata);
							PSU = FirstSU(LSG);
							usersuggfound = false;
							while (PSU != Nil) {
								if (strcmp(InfoSU(PSU), tempsugg) == 0) {
									usersuggfound =  true;
									break;
								}
								else {
									PSU = NextSU(PSU);
								}
							}
							if (!usersuggfound) {
								InsVSUFirst(&LSG, tempsugg);
								PSU = FirstSU(LSG);
							}
							InsVSUFirst(&LSGTemp, tempsugg);
							PSE = FirstSE(PSU);
							if (PSE != Nil) 
								strcpy(tempsugg, InfoSE(PSE));
							else {
								tempsugg[0] = ' ';
								tempsugg[1] = '\0';
							}
							CreateListSet(&LS);
                            CreateBoard(&B);
                            AmbilBoard(&B);
                            InitKursor(&B);
                            InitSelect(&B, &S);
                            system("clear");
                            printf("Score = %d\n\n", score);
                            printf("Suggestion = %s\n\n", InfoSE(PSE));
                            TulisBoard(B);
                            printf("\n\n");
                            dummygetch = getch();
                            input = getch();
                            printf("\n");
                            while (input != 'm')
                            {
                                system("clear");
                                ProsesKursor(&B, &baris, &kolom, &T, input, &error);
                                Select(&B, baris, kolom, T, &S, &score, &LS, &QFinish, &used, &LSG, &LSGTemp, &M, PSU);
                                printf("Score = %d\n\n", score);
                                PSE = FirstSE(PSU);
                                printf("Suggestion = %s\n\n", InfoSE(PSE));
                                TulisBoard(B);
                                printf("\n");
                                if (used)
									printf("Invalid Word\n");
								else
									printf("\n");
                                if (error)
                                    printf("error\n");
                                else
                                    printf("\n");
                                input = getch();
                                printf("\n");
                                error = false;
                                used = false;
                            }
                            time(&rawtime);	//INISIALISASI WAKTU
			    t = localtime(&rawtime);
			    D.YY = (*t).tm_year+1900;
			    D.MM = (*t).tm_mon+1;
			    D.DD = (*t).tm_mday;
		            J.HH = (*t).tm_hour;
		  	    J.MM = (*t).tm_min;
			    J.SS = (*t).tm_sec;
                            InsSortScoreU (&LU,D,J,score,username1);	//INSERT SCORE KE LIST SCORE
                            SalinInto(LU, kode);	// MENYALIN KE FILE EKSTERNAL
                            SelectB = false;
                            system("clear");
                            addressQ PQ;
                            PQ = Head(QFinish);
                            while (PQ != Nil) 
			    {
			    	PrintSet(InfoQ(PQ));
				printf("\n");
				PQ = NextQ(PQ);
		       	    }
				printf("Total Score = %d\n", score);
							PSU = FirstSU(LSG);
							PSE = FirstSE(PSU);
							PSUT = FirstSU(LSGTemp);
							while (PSUT != Nil) {
								PSET = FirstSE(PSUT);
								while (PSET != Nil) {
									InsVSEFirst(&LSG, PSU, InfoSE(PSET));
									PSET = NextSE(PSET);
								}
								PSUT = NextSU(PSUT);
							}
							WriteSuggestion(LSG, kode);
							printf("Press any key to continue\n");
							dummygetch = getch();
			    getch();
                            break;

                        case 2 :	//SELECT BOARD
                            PilihBoard(&selectT, &kode);
		            CreateList(&LU);
			    STARTKATA();
                            while(!(EndKata))
                    	       InitUser(&LU,&id);	// MEMASUKKAN DATA FILE EKSTERNAL KE DALAM LIST
                	    InversListU(&LU);
                            SelectB = true;
                            break;

                        case 3 :	//VIEW MY HIGH SCORES
			    ViewMyHighScores(LU,username1);
			    printf("%sPress any key to continue%s\n", magenta,cyan);
			    dummygetch = getch();
			    dummygetch = getch();
                            SelectB = true;
  			    break;

                        case 4 :	//VIEW ALL HIGH SCORES	
			    ViewAllHighScores(LU);
	              	    printf("%sPress any key to continue%s\n", magenta,cyan);
			    dummygetch = getch();
			    dummygetch = getch();
                            SelectB = true;
                            break;

                        case 5 :	//VIEW BOARD STATISTICS	
 				CreateEmptyQS(&QS);
                            	countuser = 0;
				countscore = 0;
				sumscore = 0;
				PU = FirstU(LU);
				while (PU != Nil)
				{
					PS = FirstS(PU);
					if((InfoD(PS)).YY != 0)
					{
						countuser += 1;
					}	
					while(PS != Nil)
					{
						if((InfoD(PS)).YY != 0)
						{
							countscore += 1;
							sumscore += InfoS(PS);
						}	
						PS = NextS(PS);	
					}
					PU = NextU(PU); 	
				}
				//CreateList(&LU);
				averagescore = sumscore/countscore;
				printf("%.0f user/s have played in board %d\n",countuser,kode);
				if(countscore == 0)
					averagescore = 0;
				printf("The average score in board %d is %.2f\n",kode,averagescore);
				AddQS(&QS,kode,averagescore);
				for(i=0; i<=9;i++)
				{
					switch(i)
					{
						case 0 : *x = "scores/List Users & Highscores 1.txt"; break;
						case 1 : *x = "scores/List Users & Highscores 2.txt"; break;
						case 2 : *x = "scores/List Users & Highscores 3.txt"; break;
						case 3 : *x = "scores/List Users & Highscores 4.txt"; break;
						case 4 : *x = "scores/List Users & Highscores 5.txt"; break;
						case 5 : *x = "scores/List Users & Highscores 6.txt"; break;
						case 6 : *x = "scores/List Users & Highscores 7.txt"; break;
						case 7 : *x = "scores/List Users & Highscores 8.txt"; break;
						case 8 : *x = "scores/List Users & Highscores 9.txt"; break;
						case 9 : *x = "scores/List Users & Highscores 10.txt"; break;
					}
					if(i != kode)
					{
						CreateList(&LP);
						STARTKATA();
						while(!EndKata)
							InitUser(&LP,&id);
					
						InversListU(&LP);
						sumscore = 0;
						countscore = 0;
						PX = FirstU(LP);
						while (PX != Nil)
						{
							PZ = FirstS(PX);	
							while(PZ != Nil)
							{
								if((InfoD(PZ)).YY != 0)
								{
									countscore += 1;
									sumscore += InfoS(PZ);
								}	
								PZ = NextS(PZ);	
							}
							PX = NextU(PX); 	
						}
						if (countscore == 0)
							averagescore = 0;
						else
							averagescore = sumscore/countscore;
						AddQS(&QS, i, averagescore);
					}
							
				}
				PX = FirstU(LP);
				DealokasiU(&PX);
				PZ = FirstS(PX);
				DealokasiS(&PZ);
				P = Head(QS);
				printf("Difficulty Level of Boards : \n");
				for(i=1;i<=10;i++)
				{						
					printf("%d. Board no.%d with average user scores of %.2f\n",i,InfoQ(P),Prio(P));
					P = NextQ(P);
					if (P == Nil)
					{
						break;
					}
				}
			    printf("%sPress any key to continue%s\n", magenta,cyan);
           		    dummygetch = getch();
		  	    dummygetch = getch();
			    SelectB = true;
			    break;

                        case 6 :	// LOG OUT
                            SelectB = false;
                            break;
                    }
                if(SelectB == false)
                    break;
                }
		break;
            case 3 :	// HOW TO PLAY
		HowToPlay();
                break;
            case 4 :	// ABOUT
                About();
                break;
        }
	}
	printf("%s\n", normal); //MENGGANTI WARNA TEXT TERMINAL KE AWAL
	
	return 0;
}
Exemplo n.º 19
0
	bool OnGossipHello(Player* pPlayer, Creature* pCreature)
    {
		MainMenu(pPlayer, pCreature);

        return true;
    }
Exemplo n.º 20
0
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) {

	uint32 u_t_m = ConfigMgr::GetIntDefault("u_t_m", NULL);
	float u_t_x = ConfigMgr::GetFloatDefault("u_t_x", NULL);
	float u_t_y = ConfigMgr::GetFloatDefault("u_t_y", NULL);
	float u_t_z = ConfigMgr::GetFloatDefault("u_t_z", NULL);
	float u_t_o = ConfigMgr::GetFloatDefault("u_t_o", NULL);

	if (player->isInCombat() && player->GetMapId() != 531 && player->GetMapId() != 532) {
		creature->MonsterWhisper("Vous êtes en combat.", player->GetGUID());
		player->CLOSE_GOSSIP_MENU();
		return true; }

	player->PlayerTalkClass->ClearMenus();

		switch (uiAction) {

	case 1: MainMenu(player, creature); break;

	case 10: player->CLOSE_GOSSIP_MENU(); // Karazhan
		player->TeleportTo(532, -10945.8f, -2103.85f, 92.8f, 0.9f); break;
	case 11: player->CLOSE_GOSSIP_MENU();
		player->TeleportTo(532, -11233.4f, -1697.76f, 179.3f, 0.6f); break;
		
	case 12: player->CLOSE_GOSSIP_MENU(); // Cratère
		player->TeleportTo(37, -120.103f, -52.833f, 268.7f, 0.1f); break;
	case 13: player->CLOSE_GOSSIP_MENU();
		player->TeleportTo(37, 362.67f, 97.629f, 247.5f, 3.1f); break;

	case 14: player->CLOSE_GOSSIP_MENU(); // Dala
		player->TeleportTo(571, 5819.49f, 642.93f, 647.9f, 0.1f); break;
	case 16: player->CLOSE_GOSSIP_MENU(); // Ahn Qiraj
		player->TeleportTo(531, -8512.5f, 2016.02f, 104.6f, 3.6f); break;
	case 20: player->CLOSE_GOSSIP_MENU(); // FFA
		player->TeleportTo(u_t_m, u_t_x, u_t_y, u_t_z, u_t_o); break;
		
	case 30:
		if (player->GetTeam() == ALLIANCE)
			player->ADD_GOSSIP_ITEM(9, "[20-30] La Prison", GOSSIP_SENDER_MAIN, 31);
		player->ADD_GOSSIP_ITEM(9, "[22-42] Tranchebauge", GOSSIP_SENDER_MAIN, 32);
		player->ADD_GOSSIP_ITEM(9, "[23-33] Gnomeregan", GOSSIP_SENDER_MAIN, 33);
		player->ADD_GOSSIP_ITEM(9, "[25-45] Monastère écarlate", GOSSIP_SENDER_MAIN, 34);
		player->ADD_GOSSIP_ITEM(9, "[35-45] Uldaman", GOSSIP_SENDER_MAIN, 35);
		player->ADD_GOSSIP_ITEM(9, "[39-53] Maraudon", GOSSIP_SENDER_MAIN, 36);
		player->ADD_GOSSIP_ITEM(9, "[41-51] Zul'Farrak", GOSSIP_SENDER_MAIN, 37);
		player->ADD_GOSSIP_ITEM(9, "[45-55] Temple Englouti", GOSSIP_SENDER_MAIN, 38);
		player->SEND_GOSSIP_MENU(1, creature->GetGUID());
		break;
	case 31: player->CLOSE_GOSSIP_MENU(); // Prison
		player->TeleportTo(0, -8758.238f, 820.46f, 97.635f, 3.83f); break;
	case 32: player->CLOSE_GOSSIP_MENU(); // Tranchebauge
		player->TeleportTo(1, -4786.528f, -2331.625f, 114.7f, 0.6f); break;
	case 33: player->CLOSE_GOSSIP_MENU(); // Gnomeregan
		player->TeleportTo(0, -5080.112f, 721.833f, 260.56f, 0.37f); break;
	case 34: player->CLOSE_GOSSIP_MENU(); // Monastère
		player->TeleportTo(0, 2996.03f, -784.148f, 175.22f, 2.2f); break;
	case 35: player->CLOSE_GOSSIP_MENU(); // Uldaman
		player->TeleportTo(0, -6079.128f, -3015.764f, 232.14f, 0.52f); break;
	case 36: player->CLOSE_GOSSIP_MENU(); // Maraudon
		player->TeleportTo(1, -1397.381f, 2902.977f, 137.72f, 5.31f); break;
	case 37: player->CLOSE_GOSSIP_MENU(); // Zul Farrak
		player->TeleportTo(1, -6815.779f, -2892.542f, 8.89f, 0.78f); break;
	case 38: player->CLOSE_GOSSIP_MENU(); // Temple Englouti
		player->TeleportTo(0, -10420.893f, -3794.955f, 32.67f, 3.85f); break;

		}
    return true; }
Exemplo n.º 21
0
int main (void)
{	
	/// Configure Devices //////////////////////////////////////
	// Display configuration:
		frontLCD.ddr = &DDRD;
		frontLCD.port = &PORTD;
		frontLCD.pin = &PIND;
		frontLCD.pinNr_EN = PD5;
		frontLCD.pinNr_RS = PD4;
		frontLCD.pinNr_D4 = PD0;
		frontLCD.pinNr_D5 = PD1;
		frontLCD.pinNr_D6 = PD2;
		frontLCD.pinNr_D7 = PD3;

    // Buttion A configuration
		button_A.ddr = &DDRC;
		button_A.port = &PORTC;
		button_A.pin = &PINC;
		button_A.pinNr = PC7;
		button_A.internPullup = True;
		button_A.bounce_ms = 40;
		
	// Buttion B configuration
		button_B.ddr = &DDRC;
		button_B.port = &PORTC;
		button_B.pin = &PINC;
		button_B.pinNr = PC4;
		button_B.internPullup = True;
		button_B.bounce_ms = 40;	

    // Rotary encoder A  configuration
		encoder_A.ddr = &DDRC;
		encoder_A.port = &PORTC;
		encoder_A.pin = &PINC;
		encoder_A.pinNr_A = PC6;
		encoder_A.pinNr_B = PC5;
		encoder_A.internPullup = True;
		encoder_A.autoAcceleration = True;
		encoder_A.accerelationFactor = 200;
	
	// Rotary encoder B  configuration
		encoder_B.ddr = &DDRC;
		encoder_B.port = &PORTC;
		encoder_B.pin = &PINC;
		encoder_B.pinNr_A = PC3;
		encoder_B.pinNr_B = PC2;
		encoder_B.internPullup = True;
		encoder_B.autoAcceleration = True;
		encoder_B.accerelationFactor = 100;
	/// END Configure Devices //////////////////////////////////
	
	/// INIT Devices ///////////////////////////////////////////
	// INIT display
		LCD_INIT(&frontLCD);
		LCD_CLEAR(&frontLCD);

    // INIT buttons	
		BUTTON_INIT(&button_A);
		BUTTON_INIT(&button_B);

    // INIT rotary encoders
		ROTARYENC_INIT(&encoder_A);
		ROTARYENC_INIT(&encoder_B);		
	/// END INIT Devices ///////////////////////////////////////
	
	while(1)
        MainMenu(); // Enter main-menu (see below)

	return 0;
}