/* * Cheats Codes Selection Menu */ void DrawGameList(int selIndex, struct game_entry * games, int glen, u8 alpha) { SetFontSize(14, 16); SetCurrentFont(font_comfortaa_regular); int game_y = 80, y_inc = 20; int maxPerPage = (512 - (game_y * 2)) / y_inc; int x = selIndex - (maxPerPage / 2); int max = maxPerPage + selIndex; if (max > glen) max = glen; for (; x < max; x++) { int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x)); if (x >= 0) { u8 a = ((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF); if (isGameActivated(games[x])) { DrawTextureCentered(menu_textures[mark_arrow_png_index], MENU_ICON_OFF + (MENU_TITLE_OFF / 2), game_y + (y_inc / 2), 0, MENU_TITLE_OFF / 3, y_inc / 2, 0xFFFFFF00 | a); } SetFontColor(0x00000000 | a, 0x00000000); if (games[x].name) { char * nBuffer = (char*)malloc(strlen(games[x].name)); strcpy(nBuffer, games[x].name); int game_name_width = 0; while ((game_name_width = WidthFromStr(nBuffer)) > 0 && (MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo + game_name_width) > (800 - (MENU_ICON_OFF * 3) - xo)) nBuffer[strlen(nBuffer) - 1] = '\0'; DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo, game_y, nBuffer); free(nBuffer); } if (games[x].title_id) DrawString(800 - (MENU_ICON_OFF * 3) - xo, game_y, games[x].title_id); if (games[x].version) DrawString(800 - (MENU_ICON_OFF * 1) - xo, game_y, games[x].version); } if (x == selIndex) { int c; for (c = 0; c < 848; c++) DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha); DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha); } game_y += y_inc; } DrawScrollBar(selIndex, glen, y_inc, 800, alpha); }
void CCherryComboBox::OnEnable(BOOL bEnable) { CComboBox::OnEnable(bEnable); if (bEnable) { m_pCurrentImage = &m_images[STATUS_NORMAL]; } else { m_pCurrentImage = &m_images[STATUS_DISABLE]; SetCurrentFont(GetDisableFont()); Invalidate(); } }
void CCherryComboBox::OnMouseHover(UINT nFlags, CPoint point) { m_bHover = TRUE; // Hover m_pCurrentImage = &m_images[STATUS_HOVER]; SetCurrentFont(GetHoverFont()); if (m_bEnableHoverHandCursor) SetClassLong(GetSafeHwnd(), GCL_HCURSOR, (LONG)AfxGetApp()->LoadStandardCursor(IDC_HAND)); Invalidate(FALSE); CComboBox::OnMouseHover(nFlags, point); }
void WMFUpdateState::SelectObject(int nIndex) { ASSERT(nIndex < m_cpaGdiObjects.GetSize()); if (nIndex != -1 && nIndex < m_cpaGdiObjects.GetSize()) { CWMFGdiObject* pObject = (CWMFGdiObject*)m_cpaGdiObjects.GetAt(nIndex); ASSERT(pObject != NULL); if (pObject != NULL) { // We have an object. switch (pObject->m_nType) { case CWMFGdiObject::Brush: { m_DCState.m_nCurrentBrush = nIndex; CWMFBrushObject* pBrush = (CWMFBrushObject*)pObject; // Handle the interior style. switch (pBrush->m_LogBrush.lbStyle) { case BS_NULL: { set_interior_style(STYLE_Empty); break; } case BS_HATCHED: { set_interior_style(STYLE_Hatch); // set_hatch_index(?); break; } case BS_PATTERN: { set_interior_style(STYLE_Pattern); break; } default: case BS_SOLID: { set_interior_style(STYLE_Solid); break; } } // Handle the interior color. set_fill_color(RGBToOutlineColor(pBrush->m_LogBrush.lbColor)); break; } case CWMFGdiObject::Pen: { m_DCState.m_nCurrentPen = nIndex; CWMFPenObject* pPen = (CWMFPenObject*)pObject; // Handle the edge visibility. set_edge_visibility(pPen->m_LogPen.lopnStyle != PS_NULL); // Handle the line/edge color. OUTLINE_COLOR Color = RGBToOutlineColor(pPen->m_LogPen.lopnColor); set_line_color(Color); set_edge_color(Color); // TRACE("Select Pen - Style: %u; Width: %d, %d; Color: %08lx\n", // pPen->m_LogPen.lopnStyle, // pPen->m_LogPen.lopnWidth.x, // pPen->m_LogPen.lopnWidth.y, // pPen->m_LogPen.lopnColor); // Handle the line/edge width. int nWidth = (pPen->m_LogPen.lopnWidth.y > pPen->m_LogPen.lopnWidth.x) ? pPen->m_LogPen.lopnWidth.y : pPen->m_LogPen.lopnWidth.x; set_edge_width((short)nWidth); set_line_width((short)nWidth); break; } case CWMFGdiObject::Font: { m_DCState.m_nCurrentFont = nIndex; SetCurrentFont(((CWMFFontObject*)pObject)->m_LogFont); break; } case CWMFGdiObject::Palette: { m_DCState.m_nCurrentPalette = nIndex; SetCurrentPalette(((CWMFPaletteObject*)pObject)->m_pPalette); break; } default: { // Invalid GDI object type. ASSERT(FALSE); break; } } } } }
void CBShellEditor::HandleKeyPress ( const int key, const JXKeyModifiers& modifiers ) { const JBoolean controlOn = modifiers.control(); const JBoolean metaOn = modifiers.meta(); const JBoolean shiftOn = modifiers.shift(); if ((key == kJLeftArrow && metaOn && !controlOn && !shiftOn) || (key == JXCtrl('A') && controlOn && !metaOn && !shiftOn)) { const JIndex index = GetInsertionIndex(); const JRunArray<Font>& styles = GetStyles(); if (index > 1 && styles.GetElement(index-1) == GetDefaultFont()) { JIndex runIndex, firstIndexInRun; const JBoolean ok = styles.FindRun(index-1, &runIndex, &firstIndexInRun); SetCaretLocation(firstIndexInRun); return; } } if (key == kJReturnKey) { SetCurrentFont(itsInsertFont); } else { SetCurrentFont(GetDefaultFont()); } JBoolean sentCmd = kJFalse; if (key == kJReturnKey && !modifiers.shift() && !HasSelection()) { JIndex index; JBoolean ok = GetCaretLocation(&index); assert( ok ); JString cmd; const JRunArray<Font>& styles = GetStyles(); if (index > 1 && styles.GetElement(index-1) == GetDefaultFont()) { JIndex runIndex, firstIndexInRun; ok = styles.FindRun(index-1, &runIndex, &firstIndexInRun); const JIndex endIndex = firstIndexInRun + styles.GetRunLength(runIndex); cmd = (GetText()).GetSubstring(firstIndexInRun, endIndex - 1); SetCaretLocation(endIndex); if (cmd.BeginsWith("man ")) { cmd.ReplaceSubstring(1, 4, "jcc --man "); } else if (cmd.BeginsWith("apropos ")) { cmd.ReplaceSubstring(1, 8, "jcc --apropos "); } else if (cmd.BeginsWith("vi ")) { cmd.ReplaceSubstring(1, 3, "jcc "); } else if (cmd.BeginsWith("less ") || cmd.BeginsWith("more ")) { cmd.ReplaceSubstring(1, 5, "jcc "); } else if (cmd == "more" || cmd == "less" || cmd == "vi") { cmd = "jcc"; } } cmd += "\n"; itsShellDoc->SendCommand(cmd); sentCmd = kJTrue; } CBTextEditor::HandleKeyPress(key, modifiers); if (sentCmd) { itsInsertIndex = GetInsertionIndex(); } }
/* ----------------------------------------------------------------- @Desc: This function draws the influencer to the screen, either to the center of the combat window if (-1,-1) was specified, or to the specified coordinates anywhere on the screen, useful e.g. for using the influencer as a cursor in the menus. @Ret: none -----------------------------------------------------------------*/ void PutInfluence ( int x, int y) { SDL_Rect dst; SDL_Rect Text_Rect; float rest, filt; Text_Rect.x=User_Rect.x+(User_Rect.w/2) + Block_Rect.w/3; Text_Rect.y=User_Rect.y+(User_Rect.h/2) - Block_Rect.h/2; Text_Rect.w=User_Rect.w/2 - Block_Rect.w/3; Text_Rect.h=User_Rect.h/2; DebugPrintf (2, "\nvoid PutInfluence(void): real function call confirmed."); // Now we draw the hat and shoes of the influencer SDL_BlitSurface( InfluencerSurfacePointer[ (int) floorf (Me.phase) ], NULL , BuildBlock, NULL); // Now we draw the first digit of the influencers current number. dst.x = FirstDigit_Rect.x; dst.y = FirstDigit_Rect.y; SDL_BlitSurface (InfluDigitSurfacePointer[ Druidmap[Me.type].druidname[0]-'1'+1 ], NULL, BuildBlock, &dst); // Now we draw the second digit of the influencers current number. dst.x = SecondDigit_Rect.x; dst.y = SecondDigit_Rect.y; SDL_BlitSurface( InfluDigitSurfacePointer[ Druidmap[Me.type].druidname[1]-'1'+1 ], NULL, BuildBlock, &dst); // Now we draw the third digit of the influencers current number. dst.x = ThirdDigit_Rect.x ; dst.y = ThirdDigit_Rect.y; SDL_BlitSurface( InfluDigitSurfacePointer[ Druidmap[Me.type].druidname[2]-'1'+1 ] , NULL, BuildBlock, &dst); if ( ( (Me.energy*100/Druidmap[Me.type].maxenergy) <= BLINKENERGY) && ( x == -1 ) ) { // In case of low energy, do the fading effect... rest = fmod(Me.timer, BLINK_LEN); // period of fading is given by BLINK_LEN if (rest < BLINK_LEN/2 ) filt = 0.40 + (1.0 - 2.0*rest/BLINK_LEN)*0.60; // decrease white->grey else filt = 0.40 + (2.0*rest/BLINK_LEN - 1.0)*0.60; // increase back to white ApplyFilter (BuildBlock, filt, filt, filt); // ... and also maybe start a new cry-sound if ( Me.LastCrysoundTime > CRY_SOUND_INTERVAL ) { Me.LastCrysoundTime = 0; CrySound(); } } //-------------------- // In case of transfer mode, we produce the transfer mode sound // but of course only in some periodic intervall... if ( Me.status == TRANSFERMODE && (x == -1)) { ApplyFilter (BuildBlock, 1.0, 0.0, 0.0); if ( Me.LastTransferSoundTime > TRANSFER_SOUND_INTERVAL ) { Me.LastTransferSoundTime = 0; TransferSound(); } } if ( x == -1 ) { dst.x=UserCenter_x - Block_Rect.w/2; dst.y=UserCenter_y - Block_Rect.h/2; } else { dst.x=x ; dst.y=y ; } SDL_BlitSurface (BuildBlock, NULL, ne_screen, &dst); //-------------------- // Maybe the influencer has something to say :) // so let him say it.. // if ( ( x == (-1) ) && ( Me.TextVisibleTime < GameConfig.WantedTextVisibleTime ) && GameConfig.Droid_Talk ) { // PutStringFont ( ne_screen , Font0_BFont , // User_Rect.x+(User_Rect.w/2) + Block_Rect.w/3 , // User_Rect.y+(User_Rect.h/2) - Block_Rect.h/2 , // Me.TextToBeDisplayed ); SetCurrentFont( Font0_BFont ); DisplayText( Me.TextToBeDisplayed, User_Rect.x+(User_Rect.w/2) + Block_Rect.w/3, User_Rect.y+(User_Rect.h/2) - Block_Rect.h/2 , &Text_Rect ); } DebugPrintf (2, "\nvoid PutInfluence(void): enf of function reached."); } /* PutInfluence() */
void DrawCheatsList(int selIndex, struct game_entry game, u8 alpha) { SetFontSize(14, 16); int game_y = 80, y_inc = 20; int maxPerPage = (512 - (game_y * 2)) / y_inc; int x = selIndex - (maxPerPage / 2); int max = maxPerPage + selIndex; if (max > game.code_count) max = game.code_count; for (; x < max; x++) { int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x)); if (x >= 0 && game.codes[x].name) { //u32 color = game.codes[x].activated ? 0x4040C000 : 0x00000000; u8 a = (u8)((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF); SetFontColor(0x00000000 | a, 0x00000000); //printf ("Drawing code name %d\n", x); SetCurrentFont(font_comfortaa_regular); float dx = DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3) - xo, game_y, game.codes[x].name); //DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3), game_y, game.codes[x].name); if (game.codes[x].activated) { DrawTexture(menu_textures[cheat_png_index], MENU_ICON_OFF, game_y, 0, (MENU_TITLE_OFF * 3) - 15, y_inc + 2, 0xFFFFFF00 | a); SetFontSize((int)(y_inc * 0.6), (int)(y_inc * 0.6)); SetFontAlign(3); //SetCurrentFont(font_comfortaa_light); SetFontColor(0xFFFFFF00 | a, 0); DrawString(MENU_ICON_OFF + ((MENU_TITLE_OFF * 3) - 15) / 2, game_y + 2, game.codes[x].cwrite ? "constant" : "once"); SetFontAlign(0); SetFontSize(14, 16); if (game.codes[x].options_count > 0 && game.codes[x].options) { int od = 0; for (od = 0; od < game.codes[x].options_count; od++) { if (game.codes[x].options[od].sel >= 0 && game.codes[x].options[od].name && game.codes[x].options[od].name[game.codes[x].options[od].sel]) { SetCurrentFont(font_comfortaa_bold); //Allocate option char * option = malloc(strlen(game.codes[x].options[od].name[game.codes[x].options[od].sel]) + 4); memset(option, 0, sizeof(option)); //If first print "(NAME", else add to list of names ", NAME" sprintf(option, (od == 0) ? " (%s" : ", %s", game.codes[x].options[od].name[game.codes[x].options[od].sel]); //If it's the last one then end the list if (od == (game.codes[x].options_count - 1)) option[strlen(option)] = ')'; SetFontColor(0x00000000 | a, 0x00000000); dx = DrawString(dx, game_y, option); free (option); } } } } } if (x == selIndex) { //Draw selection bar int c = 0; for (c = 0; c < 848; c++) DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha); DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha); } game_y += y_inc; } DrawScrollBar(selIndex, game.code_count, y_inc, 800, alpha); }
int DrawCodes(struct code_entry code, u8 alpha, int y_inc, int xOff, int selIndex) { if (!code.name || !code.codes) return 0; int numOfLines = 0, c = 0, yOff = 80, cIndex = 0; int maxPerPage = (512 - (yOff * 2)) / y_inc; int startDrawX = selIndex - (maxPerPage / 2); int max = maxPerPage + startDrawX; if (code.codes) { int len = strlen(code.codes); if (len > 0) { for (c = 0; c < len; c++) { if (code.codes[c] == '\n') { numOfLines++; } } if (numOfLines > 0) { //Splits the codes by line into an array char * splitCodes = (char *)malloc(len + 1); memcpy(splitCodes, code.codes, len); splitCodes[len] = 0; char * * lines = (char **)malloc(sizeof(char *) * numOfLines); memset(lines, 0, sizeof(char *) * numOfLines); lines[0] = (char*)(&splitCodes[0]); for (c = 1; c < numOfLines; c++) { while (splitCodes[cIndex] != '\n' && cIndex < len) cIndex++; if (cIndex >= len) break; splitCodes[cIndex] = 0; lines[c] = (char*)(&splitCodes[cIndex + 1]); } SetFontSize(y_inc-6, y_inc-4); SetCurrentFont(font_comfortaa_regular); //SetExtraSpace(0); for (c = startDrawX; c < max; c++) { if (c >= 0 && c < numOfLines) { SetFontColor(0x00000000 | ((alpha * CalculateAlphaList(c, selIndex, maxPerPage)) / 0xFF), 0); //Draw line float cX = DrawString(xOff + MENU_ICON_OFF, yOff, lines[c]); //Descriptor (removed) char * desc = (char *)malloc(200); if (GetLineDescriptor(desc, lines[c])) DrawString(xOff + cX + 20, yOff, desc); free (desc); //Selector if (c == selIndex) { int i = 0; for (i = 0; i < 848; i++) DrawTexture(menu_textures[mark_line_png_index], xOff + i, yOff, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha); } } yOff += y_inc; } free (lines); free (splitCodes); } } } SetMonoSpace(0); SetCurrentFont(0); SetExtraSpace(5); return numOfLines; }