int4 MCScreenDC::textwidth(MCFontStruct *f, const char *s, uint2 len, bool p_unicode_override) { if (len == 0) return 0; if (f->unicode || p_unicode_override) { if (MCmajorosversion >= 0x1050) { return OSX_DrawUnicodeText(0, 0, s, len, f, false, true); } else { int4 fwidth; short oldfid = GetPortTextFont(GetQDGlobalsThePort()); short oldsize = GetPortTextSize(GetQDGlobalsThePort()); short oldstyle = GetPortTextFace(GetQDGlobalsThePort()); TextFont((short)(intptr_t)f->fid); TextSize(f->size); TextFace(f->style); SInt16 baseline; CFStringRef cfstring; char *tempbuffer = NULL; if (len) { uint2 *testchar = (uint2 *)s; if (testchar[(len - 2 )>> 1] == 12398) { tempbuffer = new char[len+2]; memcpy(tempbuffer,s,len); uint2 *tchar = (uint2 *)&tempbuffer[len]; *tchar = 0; } } cfstring = CFStringCreateWithCharactersNoCopy(NULL, (UniChar *)(tempbuffer != NULL? tempbuffer: s), (tempbuffer != NULL? len + 2:len) >> 1, kCFAllocatorNull); Point dimensions = {0, 0}; GetThemeTextDimensions(cfstring, kThemeCurrentPortFont, kThemeStateActive, false, &dimensions, &baseline); fwidth = dimensions.h; CFRelease(cfstring); if (tempbuffer) delete tempbuffer; TextFont(oldfid); TextSize(oldsize); TextFace(oldstyle); return fwidth; } } else { // MW-2012-09-21: [[ Bug 3884 ]] If the font is wide, measure using OS routine. if (f -> wide)
// for scaling text void MacPrinterCanvas::flush() { // ---- check if there is anything to do ---- //int nchars = (int) (text_ptr_ - text_buff_); //if ((nchars == 0) || (lg_font_ == nil)) // return; // ---- render the text ---- if (text_item_.count > 0) { //set font FontRep* fr = lg_font_->rep(nil); TextFont(fr->font_); TextFace(fr->face_); float a00, a01, a10, a11, a20, a21; transformer().matrix(a00, a01, a10, a11, a20, a21); int size = int(double(fr->size_)*sqrt(a00*a00 + a01*a01) +.01); TextSize(size); TextMode(fr->mode_); //if (printing) debugfile("flush %d %d\n",toPixelX(text_item_.x), toPixelY(text_item_.y)); MoveTo(toPixelX(text_item_.x), toPixelY(text_item_.y)); DrawText(text_item_.buffer, 0, text_item_.count); // text_item_.buffer[text_item_.count] = '\0'; // debugfile("|%s|\n", text_item_.buffer); } text_item_.count = 0; return; }
///////////////////////////////////////////////////////////// // // DrawString // void nsPluginInstance::DrawString(const unsigned char* text, short width, short height, short centerX, Rect drawRect) { short length, textHeight, textWidth; if(text == NULL) return; length = strlen((char*)text); TextFont(1); TextFace(bold); TextMode(srcCopy); TextSize(12); FontInfo fontInfo; GetFontInfo(&fontInfo); textHeight = fontInfo.ascent + fontInfo.descent + fontInfo.leading; textWidth = TextWidth(text, 0, length); if (width > textWidth && height > textHeight) { MoveTo(centerX - (textWidth >> 1), height >> 1); DrawText(text, 0, length); }
void SetFont( TextSpec *spec) { TextFont(spec->font); TextFace(spec->style); TextSize(spec->size); }
static void setfontsizestyle (short fontnum, short fontsize, short fontstyle) { TextFont (fontnum); TextSize (fontsize); TextFace (fontstyle); } /*setfontsizestyle*/
static void set_font(int font) { double rad, scale, ux, uy; int family, size, angle; double width, height, capheight; StyleParameter face; Str255 name; font = abs(font); if (font >= 101 && font <= 129) font -= 100; else if (font >= 1 && font <= 32) font = map[font - 1]; else font = 9; WC_to_NDC_rel(gkss->chup[0], gkss->chup[1], gkss->cntnr, ux, uy); seg_xform_rel(&ux, &uy); rad = -atan2(ux, uy); angle = (int)(rad * 180 / M_PI + 0.5); if (angle < 0) angle += 360; p->path = ((angle + 45) / 90) % 4; scale = sqrt(gkss->chup[0] * gkss->chup[0] + gkss->chup[1] * gkss->chup[1]); ux = gkss->chup[0] / scale * gkss->chh; uy = gkss->chup[1] / scale * gkss->chh; WC_to_NDC_rel(ux, uy, gkss->cntnr, ux, uy); width = 0; height = sqrt(ux * ux + uy * uy); seg_xform_rel(&width, &height); height = sqrt(width * width + height * height); capheight = nint(height * (fabs(p->c) + 1)); p->capheight = nint(capheight); size = nint(capheight / capheights[font - 1]); if (font > 13) font += 3; p->family = (font - 1) / 4; face = (font % 4 == 1 || font % 4 == 2) ? normal : bold; if (font % 4 == 2 || font % 4 == 0) face |= italic; CopyCStringToPascal(fonts[p->family], name); family = FMGetFontFamilyFromName(name); if (family != kInvalidFontFamily) { TextFont(family); TextFace(face); TextSize(size); } else gks_perror("invalid font family (%s)", fonts[p->family]); }
void _HYPlatformGraphicPane::_SetFont (_HYFont f) { Str255 fontFace; StringToStr255 (f.face,fontFace); short fNum; GetFNum (fontFace,&fNum); TextFont (fNum); TextSize (f.size); TextFace (f.style); }
void RestoreQDDrawingState( QDDrawingState *inDrawingState, const Boolean inDisposeNow ) {// PixPatHandle tempPixPat; #if !(ALIST_USEAPPEARANCEMGR && TARGET_RT_MAC_CFM ) #pragma unused( inDisposeNow ) // Eliminate compiler warnings in 68K targets because PixPatHandle stuff is screwed up! #endif Assert( inDrawingState != nil ); // Restore the pen/foreground state. /* if ( !inDisposeNow && inDrawingState->penPixPatH != nil ) { // Make a copy of the penPixPatH so we can put it somewhere else later because we're not supposed to dispose of it now. tempPixPat = NewPixPat( ); if ( tempPixPat != nil ) CopyPixPat( inDrawingState->penPixPatH, tempPixPat ); } else tempPixPat = nil; PenPixPat( inDrawingState->penPixPatH ); inDrawingState->penPixPatH = tempPixPat; */ RGBForeColor( &inDrawingState->foreColor ); SetPenState( &inDrawingState->penState ); // Restore the background state. /* if ( !inDisposeNow && inDrawingState->backPixPatH != nil ) { // Make a copy of the backPixPatH so we can put it somewhere else later because we're not supposed to dispose of it now. tempPixPat = NewPixPat( ); if ( tempPixPat != nil ) CopyPixPat( inDrawingState->backPixPatH, tempPixPat ); } else tempPixPat = nil; BackPixPat( inDrawingState->backPixPatH ); inDrawingState->penPixPatH = tempPixPat; */ RGBBackColor( &inDrawingState->backColor ); // Optionally restore the text state. if ( inDrawingState->haveTextState ) { TextFont( inDrawingState->textStyle.tsFont ); TextFace( inDrawingState->textStyle.tsFace ); TextSize( inDrawingState->textStyle.tsSize ); TextMode( inDrawingState->textMode ); } #if ALIST_USEAPPEARANCEMGR && TARGET_RT_MAC_CFM // If we're running under CFM and have Appearance Mgr 1.1 or later, use the ThemeDrawingState routines. if ( inDrawingState->haveThemeState ) { SetThemeDrawingState( inDrawingState->themeState, inDisposeNow ); if ( inDisposeNow ) inDrawingState->themeState = nil; } #endif }
void mac_setfont(GWorldPtr world, Str255 fontname) { GDHandle oldGD; GWorldPtr oldGW; GetGWorld(&oldGW, &oldGD); LockPixels(world->portPixMap); { short fontID; SetGWorld( world, 0); GetFNum(fontname, &fontID); TextFont(fontID); TextSize(14); TextFace(extend/*|bold*/); } SetGWorld(oldGW, oldGD); UnlockPixels(world->portPixMap); }
int16 AboutDialog::hit(void) { GrafPtr saveport; short item; GetPort(&saveport); SetPort(dialogptr); BringToFront(dialogptr); TextFont(geneva); TextFace(0); TextSize(10); ShowWindow(dialogptr); ModalDialog(NULL, &item); SetPort(saveport); return item; }
void x_redraw_status_lines() { // OG Disable status line #ifndef ACTIVEGS Rect rect; Pattern white_pattern; char tmp_buf[256]; char *buf; int len; int line; int height; int margin; SetPortWindowPort(g_main_window); PenNormal(); height = 16; margin = 0; TextFont(g_status_font_family); TextFace(normal); TextSize(12); SetRect(&rect, 0, X_A2_WINDOW_HEIGHT + margin, X_A2_WINDOW_WIDTH, X_A2_WINDOW_HEIGHT + margin + MAX_STATUS_LINES*height); GetQDGlobalsWhite(&white_pattern); FillRect(&rect, &white_pattern); for(line = 0; line < MAX_STATUS_LINES; line++) { buf = g_status_ptrs[line]; if(buf == 0) { /* skip it */ continue; } MoveTo(10, X_A2_WINDOW_HEIGHT + height*line + margin + height); len = MIN(250, strlen(buf)); strncpy(&tmp_buf[1], buf, len); tmp_buf[0] = len; DrawString((const unsigned char*)&tmp_buf[0]); } #endif }
void InitLicTxt(void) { Rect destRect, viewRect; FSSpec licFile; long dirID, dataSize; short vRefNum, dataRef, resRef; unsigned char* cLicFName; Str255 pLicFName; OSErr err; Handle text, stylHdl; ERR_CHECK(GetCWD(&dirID, &vRefNum)); /* open and read license file */ HLock(gControls->cfg->licFileName); if(**gControls->cfg->licFileName != nil) { cLicFName = CToPascal(*gControls->cfg->licFileName); ERR_CHECK(FSMakeFSSpec(vRefNum, dirID, cLicFName, &licFile)); if (cLicFName) DisposePtr((char*)cLicFName); } else /* assume default license filename from str rsrc */ { GetResourcedString(pLicFName, rInstList, sLicenseFName); ERR_CHECK(FSMakeFSSpec(vRefNum, dirID, pLicFName, &licFile)); } HUnlock(gControls->cfg->licFileName); /* read license text */ ERR_CHECK(FSpOpenDF( &licFile, fsRdPerm, &dataRef)); ERR_CHECK(GetEOF(dataRef, &dataSize)); if (dataSize > 0) { if (!(text = NewHandle(dataSize))) { ErrorHandler(eMem, nil); return; } ERR_CHECK(FSRead(dataRef, &dataSize, *text)); } else text = nil; ERR_CHECK(FSClose(dataRef)); /* get 'styl' if license is multistyled */ resRef = FSpOpenResFile( &licFile, fsRdPerm); ERR_CHECK(ResError()); UseResFile(resRef); stylHdl = RGetResource('styl', 128); ERR_CHECK(ResError()); if(stylHdl) DetachResource(stylHdl); else stylHdl = nil; CloseResFile(resRef); /* TE specific init */ HLock( (Handle) gControls->lw->licBox); SetRect(&viewRect, (*(gControls->lw->licBox))->contrlRect.left, (*(gControls->lw->licBox))->contrlRect.top, (*(gControls->lw->licBox))->contrlRect.right, (*(gControls->lw->licBox))->contrlRect.bottom); HUnlock( (Handle) gControls->lw->licBox); destRect.left = viewRect.left; viewRect.right = (*(gControls->lw->scrollBar))->contrlRect.left; destRect.right = viewRect.right; destRect.top = viewRect.top; destRect.bottom = viewRect.bottom * kNumLicScrns; // gControls->lw->licTxt = (TEHandle) NewPtrClear(sizeof(TEPtr)); TextFont(applFont); TextFace(normal); TextSize(9); HLock(text); if (stylHdl) { gControls->lw->licTxt = TEStyleNew( &destRect, &viewRect ); TEStyleInsert( *text, dataSize, (StScrpRec ** )stylHdl, gControls->lw->licTxt); } else { gControls->lw->licTxt = TENew( &destRect, &viewRect); TEInsert( *text, dataSize, gControls->lw->licTxt); } HUnlock(text); TextFont(systemFont); TextSize(12); TESetAlignment(teFlushDefault, gControls->lw->licTxt); }
/* ------------ Local code */ static void add_overhead_thumbnail( FileSpecifier &File) { PicHandle picture; PicHandle preview; RgnHandle clip_region; FontInfo info; short text_x, text_y; short text_length; Str255 temporary; GWorldPtr old_gworld; GDHandle old_device; struct overhead_map_data overhead_data; Rect bounds; AEDesc aeFileSpec; FSSpec *SpecPtr; // Skip all this if there's no nav services to install the preview if(!machine_has_nav_services() || NavLibraryVersion() < kNavServicesVersion_2_0) return; GetGWorld(&old_gworld, &old_device); SetGWorld(world_pixels, (GDHandle) NULL); // Note well. We're using world_pixels to create our thumbnail pict within. // If world_pixels is runing as a postage stamp (low-res + small display space) // Then it is actually smaller than the size we're looking to build a thumbnail // within. But seeing as we're generating pict images and using drawing commands // instead of bit-wise operations. It all works out. /* Create the bounding rectangle */ SetRect(&bounds, 0, 0, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT); /* Start recording.. */ picture= OpenPicture(&bounds); PaintRect(&bounds); overhead_data.scale= OVERHEAD_MAP_MINIMUM_SCALE; overhead_data.origin.x= local_player->location.x; overhead_data.origin.y= local_player->location.y; overhead_data.half_width= RECTANGLE_WIDTH(&bounds)/2; overhead_data.half_height= RECTANGLE_HEIGHT(&bounds)/2; overhead_data.width= RECTANGLE_WIDTH(&bounds); overhead_data.height= RECTANGLE_HEIGHT(&bounds); overhead_data.mode= _rendering_saved_game_preview; _render_overhead_map(&overhead_data); RGBForeColor(&rgb_black); PenSize(1, 1); TextFont(0); TextFace(normal); TextSize(0); ClosePicture(); // JTP: Add Nav Services style preview SetRect(&bounds, 0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT); preview= OpenPicture(&bounds); SetRect(&bounds, PREVIEW_IMAGE_X, PREVIEW_IMAGE_Y, THUMBNAIL_WIDTH + PREVIEW_IMAGE_X, THUMBNAIL_HEIGHT + PREVIEW_IMAGE_Y); clip_region= NewRgn(); GetClip(clip_region); ClipRect(&bounds); DrawPicture(picture, &bounds); SetClip(clip_region); /* Center the text in the rectangle */ // LP: Classic doesn't have this function #ifdef TARGET_API_MAC_CARBON CopyCStringToPascal(static_world->level_name, temporary); #else strncpy((char *)temporary,static_world->level_name,LEVEL_NAME_LENGTH); c2pstr((char *)temporary); #endif // LP: fix to allow lengths more than 127 bytes (not really necessary, but...) text_length = *ptemporary; TruncText(PREVIEW_WIDTH, (char *)temporary+1, &text_length, smTruncEnd); *ptemporary = text_length; GetFontInfo(&info); text_y= PREVIEW_HEIGHT - info.descent; text_x= PREVIEW_LABEL_X + (PREVIEW_WIDTH-StringWidth(temporary))/2; MoveTo(text_x, text_y); DrawString(temporary); ClosePicture(); // This requires NavServices 2.0, what's the inline check? // From FSS get a AEDesc OSStatus err; SpecPtr = &File.GetSpec(); err = AECreateDesc(typeFSS, SpecPtr, sizeof(FSSpec), &aeFileSpec); HLock((Handle)preview); err = NavCreatePreview(&aeFileSpec, 'PICT', *preview, GetHandleSize((Handle)preview)); HUnlock((Handle)preview); AEDisposeDesc(&aeFileSpec); KillPicture(preview); KillPicture(picture); DisposeRgn(clip_region); SetGWorld(old_gworld, old_device); }
static gx_xfont * mac_lookup_font(gx_device *dev, const byte *fname, uint len, int encoding_index, const gs_uid *puid, const gs_matrix *pmat, gs_memory_t *mem) { #pragma unused(encoding_index,puid) mac_xfont *macxf; CGrafPort *currentPort; int txFont, txSize, txMode; StyleField txFace; Fixed spExtra; /* are XFonts enabled? */ if (((gx_device_macos*) dev)->useXFonts == false) return NULL; /* we can handle only requests from these encodings */ if (encoding_index != ENCODING_INDEX_MACROMAN && encoding_index != ENCODING_INDEX_ISOLATIN1 && encoding_index != ENCODING_INDEX_STANDARD) return NULL; /* Don't render very small fonts */ if (fabs(pmat->xx * 1000.0) < 3.0) return NULL; /* Only handle simple cases for now (no transformations). */ if (fabs(pmat->xy) > 0.0001 || fabs(pmat->yx) > 0.0001 || pmat->xx <= 0) return NULL; /* allocate memory for gx_xfont */ macxf = gs_alloc_struct(mem, mac_xfont, &st_mac_xfont, "mac_lookup_font"); if (macxf == NULL) { return NULL; } /* set default values */ macxf->common.procs = &mac_xfont_procs; macxf->dev = dev; /* find the specified font */ mac_find_font_family(fname, len, &(macxf->fontID), &(macxf->fontFace)); /* no font found */ if (macxf->fontID == 0) return NULL; FMGetFontFamilyName(macxf->fontID, macxf->fontName); macxf->fontSize = (short)(pmat->xx * 1000.0); macxf->fontEncoding = mac_get_font_encoding(macxf); /* we can handle only fonts with these encodings for now (all original Mac fonts have MacRoman encoding!) */ if (macxf->fontEncoding != ENCODING_INDEX_MACROMAN && macxf->fontEncoding != ENCODING_INDEX_ISOLATIN1) return NULL; /* get font metrics */ /* save current GrafPort's font information */ GetPort(&((GrafPort*) currentPort)); txFont = currentPort->txFont; txSize = currentPort->txSize; txFace = currentPort->txFace; txMode = currentPort->txMode; spExtra = currentPort->spExtra; /* set values for measuring */ TextFont(macxf->fontID); TextSize(macxf->fontSize); TextFace(macxf->fontFace); TextMode(srcOr); SpaceExtra(0); /* measure font */ FontMetrics(&(macxf->fontMetrics)); /* restore current GrafPort's font information */ currentPort->txFont = txFont; currentPort->txSize = txSize; currentPort->txFace = txFace; currentPort->txMode = txMode; currentPort->spExtra = spExtra; return (gx_xfont*) macxf; }
// -------------------------------------------------------------------------------------- static void drawIconListCell(ListHandle theList, const Rect *cellRect, IconListCellDataRec *theCellData, Boolean selected) { GrafPtr savedPort; CGrafPtr listPort; ThemeDrawingState savedState; Boolean active; Rect iconRect, textRect; short savedFont, savedSize; Style savedFace; CFStringRef cellName; GetPort(&savedPort); listPort = GetListPort(theList); SetPort((GrafPtr)listPort); GetThemeDrawingState(&savedState); if (selected) // we don't need to change the background { // color if this Cell isn't highlighted Pattern whitePattern; RGBColor highlightColor; GetQDGlobalsWhite(&whitePattern); // set the background pattern so that BackPat(&whitePattern); // the color is properly set as a solid color LMGetHiliteRGB(&highlightColor); RGBBackColor(&highlightColor); // set the background to the highlight color } EraseRect(cellRect); calculateDrawingBounds(cellRect, &iconRect, &textRect); // get the drawing Rects active = GetListActive(theList); // draw the IconRef using Icon Services PlotIconRef(&iconRect, kAlignNone, active ? kTransformNone : kTransformDisabled, kIconServicesNormalUsageFlag, theCellData->icon); #if TARGET_API_MAC_OS8 // draw TextEdit text in Classic #pragma unused (cellName) savedFont = GetPortTextFont(listPort); // Get/SetThemeDrawingState doesn't save or savedFace = GetPortTextFace(listPort); // restore these savedSize = GetPortTextSize(listPort); UseThemeFont(kThemeViewsFont, smCurrentScript); TETextBox(&theCellData->name[1], theCellData->name[0], &textRect, teCenter); TextFont(savedFont); TextFace(savedFace); TextSize(savedSize); #else // draw Appearance text in Carbon #pragma unused (savedFont, savedSize, savedFace) cellName = CFStringCreateWithPascalString(kCFAllocatorDefault, theCellData->name, GetApplicationTextEncoding()); DrawThemeTextBox(cellName, kThemeViewsFont, active ? kThemeStateActive : kThemeStateInactive, true, &textRect, teCenter, NULL); CFRelease(cellName); #endif SetThemeDrawingState(savedState, true); SetPort(savedPort); } // drawIconListCell
void draw_shop_graphics(bool pressed,Rect clip_area_rect) // mode 1 - drawing dark for button press { Rect area_rect,item_info_from = {11,42,24,56}; Rect face_rect = {6,6,38,38}; Rect title_rect = {15,48,42,260}; Rect dest_rect,help_from = {85,36,101,54}; short faces[13] = {1,1,1,42,43, 1,1,1,1,1, 44,44,44}; short i,what_chosen; RGBColor c[7] = {{0,0,0},{0,0,32767},{0,0,14535},{0,0,26623},{0,0,59391}, {0,40959,0},{0,24575,0}}; Rect shopper_name = {44,6,56,260}; short current_pos; short cur_cost,what_magic_shop,what_magic_shop_item; char cur_name[60]; char cur_info_str[60]; char *cost_strs[] = {"Extremely Cheap","Very Reasonable","Pretty Average","Somewhat Pricey", "Expensive","Exorbitant","Utterly Ridiculous"}; GrafPtr old_port; cItemRec base_item; if (overall_mode != 21) { return; } GetPort(&old_port); SetPort(talk_gworld); TextFont(dungeon_font_num); TextSize(18); TextFace(0); if (pressed) { ClipRect(&clip_area_rect); } GetPortBounds(talk_gworld,&area_rect); FrameRect(&area_rect); InsetRect(&area_rect,1,1); tileImage(area_rect,bg_gworld,bg[12]); FrameRect(&shop_frame); // Place store icon if (!pressed) { SetPort(GetWindowPort(mainPtr)); i = faces[store_shop_type]; draw_dialog_graphic( talk_gworld, face_rect, i, PICT_TALK, false,1); SetPort( talk_gworld); } // Place name of store and shopper name RGBForeColor(&c[3]); dest_rect = title_rect; OffsetRect(&dest_rect,1,1); char_port_draw_string(talk_gworld,dest_rect,store_store_name,2,18); OffsetRect(&dest_rect,-1,-1); RGBForeColor(&c[4]); char_port_draw_string( talk_gworld,dest_rect,store_store_name,2,18); TextFont(geneva_font_num); TextSize(12); TextFace(bold); RGBForeColor(&c[3]); switch (store_shop_type) { case 3: sprintf(cur_name,"Healing for %s.",univ.party[current_pc].name.c_str()); break; case 10: sprintf(cur_name,"Mage Spells for %s.",univ.party[current_pc].name.c_str());break; case 11: sprintf(cur_name,"Priest Spells for %s.",univ.party[current_pc].name.c_str()); break; case 12: sprintf(cur_name,"Buying Alchemy.");break; case 4: sprintf(cur_name,"Buying Food.");break; default:sprintf(cur_name,"Shopping for %s.",univ.party[current_pc].name.c_str()); break; } char_port_draw_string( talk_gworld,shopper_name,cur_name,2,18); // Place help and done buttons ForeColor(blackColor); GetPortBounds(dlg_buttons_gworld[3][0],&help_from); talk_help_rect.right = talk_help_rect.left + help_from.right - help_from.left; talk_help_rect.bottom = talk_help_rect.top + help_from.bottom - help_from.top; rect_draw_some_item(dlg_buttons_gworld[3][pressed],help_from,talk_gworld,talk_help_rect); GetPortBounds(dlg_buttons_gworld[11][0],&help_from); //talk_help_rect.right = talk_help_rect.left + help_from.right - help_from.left; //talk_help_rect.bottom = talk_help_rect.top + help_from.bottom - help_from.top; rect_draw_some_item(dlg_buttons_gworld[11][pressed],help_from,talk_gworld,shop_done_rect); if (pressed) RGBForeColor(&c[4]); else ForeColor(blackColor); // Place all the items for (i = 0; i < 8; i++) { current_pos = i + GetControlValue(shop_sbar); if (store_shop_items[current_pos] < 0) break; // theoretically, this shouldn't happen cur_cost = store_shop_costs[current_pos]; what_chosen = store_shop_items[current_pos]; switch (what_chosen / 100) { case 0: case 1: case 2: case 3: case 4: base_item = get_stored_item(what_chosen); base_item.ident = true; draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); strcpy(cur_name,base_item.full_name.c_str()); get_item_interesting_string(base_item,cur_info_str); break; case 5: base_item = store_alchemy(what_chosen - 500); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],53,PICT_ITEM, false,1);//// all graphic nums strcpy(cur_name,base_item.full_name.c_str()); strcpy(cur_info_str,""); break; case 6: //base_item = food_types[what_chosen - 600]; //draw_dialog_graphic( talk_gworld, shopping_rects[i][2],633, false,1); //strcpy(cur_name,base_item.full_name); //get_item_interesting_string(base_item,cur_info_str); break; case 7: what_chosen -= 700; draw_dialog_graphic( talk_gworld, shopping_rects[i][2],99,PICT_ITEM, false,1); strcpy(cur_name,heal_types[what_chosen]); strcpy(cur_info_str,""); break; case 8: base_item = store_mage_spells(what_chosen - 800 - 30); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); strcpy(cur_name,base_item.full_name.c_str()); strcpy(cur_info_str,""); break; case 9: base_item = store_priest_spells(what_chosen - 900 - 30); draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); strcpy(cur_name,base_item.full_name.c_str()); strcpy(cur_info_str,""); break; default: what_magic_shop = (what_chosen / 1000) - 1; what_magic_shop_item = what_chosen % 1000; base_item = univ.party.magic_store_items[what_magic_shop][what_magic_shop_item]; base_item.ident = true; draw_dialog_graphic( talk_gworld, shopping_rects[i][2],base_item.graphic_num,PICT_ITEM, false,1); strcpy(cur_name,base_item.full_name.c_str()); get_item_interesting_string(base_item,cur_info_str); break; } // Now draw item shopping_rects[i][7] // 0 - whole area, 1 - active area 2 - graphic 3 - item name // 4 - item cost 5 - item extra str 6 - item help button TextSize(12); char_port_draw_string( talk_gworld,shopping_rects[i][3],cur_name,0,12); sprintf(cur_name,"Cost: %d",cur_cost); char_port_draw_string( talk_gworld,shopping_rects[i][4],cur_name,0,12); TextSize(10); char_port_draw_string( talk_gworld,shopping_rects[i][5],cur_info_str,0,12); if ((store_shop_type != 3) && (store_shop_type != 4)) rect_draw_some_item(invenbtn_gworld,item_info_from,talk_gworld,shopping_rects[i][6],pressed ? srcCopy : transparent); } // Finally, cost info and help strs TextSize(12); sprintf(cur_name,"Prices here are %s.",cost_strs[store_cost_mult]); TextSize(10); char_port_draw_string( talk_gworld,bottom_help_rects[0],cur_name,0,12); char_port_draw_string( talk_gworld,bottom_help_rects[1],"Click on item name (or type 'a'-'h') to buy.",0,12); char_port_draw_string( talk_gworld,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,12); if ((store_shop_type != 3) && (store_shop_type != 4)) char_port_draw_string( talk_gworld,bottom_help_rects[3],"'I' button brings up description.",0,12); ForeColor(blackColor); GetPortBounds(talk_gworld,&area_rect); ClipRect(&area_rect); SetPort(old_port); refresh_shopping(); ShowControl(shop_sbar); Draw1Control(shop_sbar); }
void do_explosion_anim(short sound_num,short special_draw) // sound_num currently ignored // special_draw - 0 normal 1 - first half 2 - second half { Rect temp_rect,active_area_rect,to_rect,from_rect; Rect base_rect = {0,0,36,28},text_rect; char str[60]; short i,temp_val,temp_val2; location screen_ul; short t,cur_boom_type = 0; Point current_terrain_ul; GWorldPtr temp_gworld; GrafPtr old_port; short boom_type_sound[3] = {5,10,53}; if ((have_boom == false) || (boom_anim_active == false)) { boom_anim_active = false; return; } for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) i = 50; if (i == 30) return; // initialize general data if (in_startup_mode) { current_terrain_ul.h = 306; current_terrain_ul.v = 5; } else current_terrain_ul.h = current_terrain_ul.v = 5; // make terrain_template contain current terrain all nicely draw_terrain(1); if (special_draw != 2) { GetPortBounds(terrain_screen_gworld,&to_rect); Rect oldRect = to_rect; OffsetRect(&to_rect,current_terrain_ul.h, current_terrain_ul.v); rect_draw_some_item(terrain_screen_gworld,oldRect,to_rect,ul); } GetPort(&old_port); // create and clip temporary anim template GetPortBounds(terrain_screen_gworld,&temp_rect); NewGWorld(&temp_gworld, 0 /*8*/,&temp_rect, NULL, NULL, kNativeEndianPixMap); SetPort(temp_gworld); TextFont(geneva_font_num); TextFace(bold); TextSize(10); active_area_rect = temp_rect; InsetRect(&active_area_rect,13,13); ClipRect(&active_area_rect); SetPort(GetWindowPort(mainPtr)); // init missile paths screen_ul.x = center.x - 4; screen_ul.y = center.y - 4; for (i = 0; i < 30; i++) if ((store_booms[i].boom_type >= 0) && (special_draw < 2)) { cur_boom_type = store_booms[i].boom_type; explode_place_rect[i] = base_rect; OffsetRect(&explode_place_rect[i],13 + 28 * (store_booms[i].dest.x - screen_ul.x) + store_booms[i].x_adj, 13 + 36 * (store_booms[i].dest.y - screen_ul.y) + store_booms[i].y_adj); if ((store_booms[i].place_type == 1) && (special_draw < 2)) { temp_val = get_ran(1,0,50) - 25; temp_val2 = get_ran(1,0,50) - 25; OffsetRect(&explode_place_rect[i],temp_val,temp_val2); } // eliminate stuff that's too gone. Rect tempRect2; GetPortBounds(terrain_screen_gworld,&tempRect2); SectRect(&explode_place_rect[i],&tempRect2,&temp_rect); if (EqualRect(&temp_rect,&explode_place_rect[i]) == false) { store_booms[i].boom_type = -1; } } else if (special_draw < 2) explode_place_rect[i].top =explode_place_rect[i].left =explode_place_rect[i].bottom =explode_place_rect[i].right = 0; //play_sound(-1 * sound_num); if (special_draw < 2) play_sound(-1 * boom_type_sound[cur_boom_type]); // Now, at last, do explosion for (t = (special_draw == 2) ? 6 : 0; t < ((special_draw == 1) ? 6 : 11); t++) { // t goes up to 10 to make sure screen gets cleaned up // First, lay terrain in temporary graphic area; for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) rect_draw_some_item(terrain_screen_gworld,explode_place_rect[i], temp_gworld,explode_place_rect[i]); // Now put in explosions for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) { if ((t + store_booms[i].offset >= 0) && (t + store_booms[i].offset <= 7)) { from_rect = base_rect; OffsetRect(&from_rect,28 * (t + store_booms[i].offset),36 * (1 + store_booms[i].boom_type)); rect_draw_some_item(boom_gworld,from_rect, temp_gworld,explode_place_rect[i],transparent); if (store_booms[i].val_to_place > 0) { text_rect = explode_place_rect[i]; text_rect.top += 4; text_rect.left -= 10; if (store_booms[i].val_to_place < 10) text_rect.left += 8; sprintf(str,"%d",store_booms[i].val_to_place); SetPort(temp_gworld); ForeColor(whiteColor); char_port_draw_string(temp_gworld,text_rect,str,1,12); ForeColor(blackColor); SetPort(GetWindowPort(mainPtr)); } } } // Now draw all missiles to screen for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) { to_rect = explode_place_rect[i]; OffsetRect(&to_rect,current_terrain_ul.h,current_terrain_ul.v); rect_draw_some_item(temp_gworld,explode_place_rect[i],to_rect,ul); } //if (((PSD[SDF_GAME_SPEED] == 1) && (t % 3 == 0)) || ((PSD[SDF_GAME_SPEED] == 2) && (t % 2 == 0))) FlushAndPause(2 * (1 + PSD[SDF_GAME_SPEED])); } // Exit gracefully, and clean up screen for (i = 0; i < 30; i++) if (special_draw != 1) store_booms[i].boom_type = -1; DisposeGWorld(temp_gworld); SetPort(old_port); //to_rect = terrain_screen_gworld->portRect; //OffsetRect(&to_rect,current_terrain_ul.h,current_terrain_ul.v); //rect_draw_some_item(terrain_screen_gworld,terrain_screen_gworld->portRect, // terrain_screen_gworld,to_rect,0,1); }
void place_talk_str(char *str_to_place,char *str_to_place2,short color,Rect c_rect) // color 0 - regular 1 - darker { Rect area_rect; Rect face_rect = {6,6,38,38}; Rect title_rect = {19,48,42,260}; Rect dest_rect,help_from = {85,36,101,54}; Str255 fn2 = "\pDungeon Bold"; Str255 fn3 = "\pPalatino"; short i,j,str_len,line_height = 17; Str255 p_str,str,str_to_draw,str_to_draw2; short text_len[257],current_rect,store_last_word_break = 0,start_of_last_kept_word = -1; short last_line_break = 0,last_word_break = 0,on_what_line = 0,last_stored_word_break = 0; bool force_skip = false; short face_to_draw; RGBColor c[7] = {{0,0,0},{0,0,32767},{0,0,14535},{0,0,26623},{0,0,59391}, {0,40959,0},{0,24575,0}}; GrafPtr old_port; GetPort(&old_port); SetPort( talk_gworld); // This redundancy is to try to keep the font from disappearing GetFNum(fn2,&dungeon_font_num); if (dungeon_font_num == 0) GetFNum(fn3,&dungeon_font_num); TextFont(dungeon_font_num); //TextFont(geneva_font_num); TextSize(18); TextFace(0); if (c_rect.right > 0) { ClipRect(&c_rect); } GetPortBounds(talk_gworld,&area_rect); FrameRect(&area_rect); InsetRect(&area_rect,1,1); tileImage(area_rect,bg_gworld,bg[12]); // Put help button GetPortBounds(dlg_buttons_gworld[3][0], &help_from); talk_help_rect.right = talk_help_rect.left + help_from.right - help_from.left; talk_help_rect.bottom = talk_help_rect.top + help_from.bottom - help_from.top; rect_draw_some_item(dlg_buttons_gworld[3][0],help_from,talk_gworld,talk_help_rect); // Place face of talkee if ((color == 0) && (c_rect.right == 0)) { //// SetPort(GetWindowPort(mainPtr)); face_to_draw = scenario.scen_monsters[store_monst_type].default_facial_pic; if (store_talk_face_pic >= 0) face_to_draw = store_talk_face_pic; if (store_talk_face_pic >= 1000) { draw_dialog_graphic( talk_gworld, face_rect, store_talk_face_pic, PICT_CUSTOM + PICT_TALK, false,1); } else { i = get_monst_picnum(store_monst_type); if (face_to_draw <= 0) draw_dialog_graphic(talk_gworld, face_rect, i, get_monst_pictype(store_monst_type), false,1); else draw_dialog_graphic(talk_gworld, face_rect, face_to_draw, PICT_MONST, false,1); } SetPort( talk_gworld); } // Place name oftalkee RGBForeColor(&c[3]); dest_rect = title_rect; OffsetRect(&dest_rect,1,1); char_port_draw_string( talk_gworld,dest_rect,title_string,2,18); OffsetRect(&dest_rect,-1,-1); RGBForeColor(&c[4]); char_port_draw_string( talk_gworld,dest_rect,title_string,2,18); // Place buttons at bottom. if (color == 0) RGBForeColor(&c[5]); else RGBForeColor(&c[6]); for (i = 0; i < 9; i++) if ((talk_end_forced == false) || (i == 6) || (i == 5)) { OffsetRect(&preset_words[i].word_rect,0,8); char_port_draw_string( talk_gworld,preset_words[i].word_rect,preset_words[i].word,2,18); OffsetRect(&preset_words[i].word_rect,0,-8); } // Place bulk of what said. Save words. //TextSize(14); if (color == 0) for (i = 0; i < 50; i++) store_words[i].word_rect.left = store_words[i].word_rect.right = 0; str_len = (short) strlen((char *)str_to_place); if (str_len == 0) { sprintf((char *) str_to_place,"."); } strcpy((char *) str,str_to_place); strcpy((char *) p_str,str_to_place); c2pstr((char*)p_str); for (i = 0; i < 257; i++) text_len[i]= 0; MeasureText(256,p_str,text_len); dest_rect = word_place_rect; current_rect = 0; if (color == 0) RGBForeColor(&c[2]); else RGBForeColor(&c[1]); MoveTo(dest_rect.left + 1 , dest_rect.top + 1 + line_height * on_what_line + 9); //for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) { for (i = 0;i < str_len;i++) { if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect if (((i - store_last_word_break >= 4) || (i >= str_len - 1)) && (i - last_stored_word_break >= 4) && (talk_end_forced == false)) { store_words[current_rect].word_rect.left = dest_rect.left + (text_len[store_last_word_break] - text_len[last_line_break]) - 2; store_words[current_rect].word_rect.right = dest_rect.left + (text_len[i + 1] - text_len[last_line_break]) - 1; store_words[current_rect].word_rect.top = dest_rect.top + 1 + line_height * on_what_line - 5; store_words[current_rect].word_rect.bottom = dest_rect.top + 1 + line_height * on_what_line + 13; if ((str[store_last_word_break] < 48) || (str[store_last_word_break] == 96) || (str[store_last_word_break] > 122) || ((str[store_last_word_break] >= 58) && (str[store_last_word_break] <= 64))) store_last_word_break++; // adjust for if this word will be scrolled down //if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) // && (last_word_break > last_line_break)) || (str[i] == '|')) { // OffsetRect(&store_words[current_rect].word_rect,5 + -1 * store_words[current_rect].word_rect.left,line_height); // } store_words[current_rect].word[0] = str[store_last_word_break]; store_words[current_rect].word[1] = str[store_last_word_break + 1]; store_words[current_rect].word[2] = str[store_last_word_break + 2]; store_words[current_rect].word[3] = str[store_last_word_break + 3]; store_words[current_rect].word[4] = 0; for (j = 0; j < 4; j++) if ((store_words[current_rect].word[j] >= 65) && (store_words[current_rect].word[j] <= 90)) store_words[current_rect].word[j] += 32; if (scan_for_response(store_words[current_rect].word) < 0) { store_words[current_rect].word_rect.left = store_words[current_rect].word_rect.right = 0; } else { start_of_last_kept_word = store_last_word_break; if (current_rect < 49) current_rect++; //FrameRect(&store_words[current_rect].word_rect); } last_stored_word_break = i + 1; } } if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) && (last_word_break > last_line_break)) || (str[i] == '|') || (i == str_len - 1)) { if (str[i] == '|') { str[i] = ' '; force_skip = true; } store_last_word_break = last_word_break; if (i == str_len - 1) last_word_break = i + 2; sprintf((char *)str_to_draw," "); strncpy ((char *) str_to_draw,(char *) str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); sprintf((char *)str_to_draw2," %s",str_to_draw); str_to_draw2[0] = (char) strlen((char *)str_to_draw); DrawString(str_to_draw2); on_what_line++; MoveTo(dest_rect.left + 1 , dest_rect.top + 1 + line_height * on_what_line + 9); last_line_break = last_word_break; if (force_skip == true) { force_skip = false; i++; last_line_break++; last_word_break++; } if ((start_of_last_kept_word >= last_line_break) && (current_rect > 0)) { //SysBeep(2); OffsetRect(&store_words[current_rect - 1].word_rect,5 + -1 * store_words[current_rect - 1].word_rect.left,line_height); } } if (str[i] == ' ') { // New word store_last_word_break = last_word_break = i + 1; } if (on_what_line == 17) i = 10000; } // Now for string 2 str_len = (short) strlen((char *)str_to_place2); start_of_last_kept_word = -1; if (str_len > 0) { strcpy((char *) str,str_to_place2); strcpy((char *) p_str,str_to_place2); c2pstr((char*)p_str); for (i = 0; i < 257; i++) text_len[i]= 0; MeasureText(256,p_str,text_len); last_line_break = store_last_word_break = last_word_break = last_stored_word_break = 0; MoveTo(dest_rect.left + 1 , dest_rect.top + 1 + line_height * on_what_line + 9); //for (i = 0;text_len[i] != text_len[i + 1], i < str_len;i++) for (i = 0;i < str_len;i++) { if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect if (((i - store_last_word_break >= 4) || (i >= str_len - 1)) && (i - last_stored_word_break >= 4) && (talk_end_forced == false)) { store_words[current_rect].word_rect.left = dest_rect.left + (text_len[store_last_word_break] - text_len[last_line_break]) - 2; store_words[current_rect].word_rect.right = dest_rect.left + (text_len[i + 1] - text_len[last_line_break]) - 1; store_words[current_rect].word_rect.top = dest_rect.top + 1 + line_height * on_what_line - 5; store_words[current_rect].word_rect.bottom = dest_rect.top + 1 + line_height * on_what_line + 13; if ((str[store_last_word_break] < 48) || (str[store_last_word_break] == 96) || (str[store_last_word_break] > 122) || ((str[store_last_word_break] >= 58) && (str[store_last_word_break] <= 64))) store_last_word_break++; // adjust for if this word will be scrolled down //if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) // && (last_word_break > last_line_break)) || (str[i] == '|')) { // OffsetRect(&store_words[current_rect].word_rect,5 + -1 * store_words[current_rect].word_rect.left,line_height); // } store_words[current_rect].word[0] = str[store_last_word_break]; store_words[current_rect].word[1] = str[store_last_word_break + 1]; store_words[current_rect].word[2] = str[store_last_word_break + 2]; store_words[current_rect].word[3] = str[store_last_word_break + 3]; store_words[current_rect].word[4] = 0; for (j = 0; j < 4; j++) if ((store_words[current_rect].word[j] >= 65) && (store_words[current_rect].word[j] <= 90)) store_words[current_rect].word[j] += 32; if (scan_for_response(store_words[current_rect].word) < 0) store_words[current_rect].word_rect.left = store_words[current_rect].word_rect.right = 0; else { start_of_last_kept_word = store_last_word_break; if (current_rect < 49) current_rect++; //FrameRect(&store_words[current_rect].word_rect); } last_stored_word_break = i + 1; } } if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) && (last_word_break > last_line_break)) || (str[i] == '|') || (i == str_len - 1)) { if (str[i] == '|') { str[i] = ' '; force_skip = true; } store_last_word_break = last_word_break; if (i == str_len - 1) last_word_break = i + 2; sprintf((char *)str_to_draw," "); strncpy ((char *) str_to_draw,(char *) str + last_line_break,(size_t) (last_word_break - last_line_break - 1)); sprintf((char *)str_to_draw2," %s",str_to_draw); str_to_draw2[0] = (char) strlen((char *)str_to_draw); DrawString(str_to_draw2); on_what_line++; MoveTo(dest_rect.left + 1 , dest_rect.top + 1 + line_height * on_what_line + 9); last_line_break = last_word_break; if (force_skip == true) { force_skip = false; i++; last_line_break++; last_word_break++; } if ((start_of_last_kept_word >= last_line_break) && (current_rect > 0)) { OffsetRect(&store_words[current_rect - 1].word_rect,5 + -1 * store_words[current_rect - 1].word_rect.left,line_height); } } if (str[i] == ' ') { // New word store_last_word_break = last_word_break = i + 1; } if (on_what_line == 17) i = 10000; } } ForeColor(blackColor); GetPortBounds(talk_gworld,&area_rect); Rect oldRect = area_rect; ClipRect(&area_rect); // Finally place processed graphics SetPort(GetWindowPort(mainPtr)); rect_draw_some_item(talk_gworld,oldRect,talk_area_rect,ul); SetPort(old_port); // Clean up strings for (i = 0; i < 50; i++) for (j = 0; j < 4; j++) if ((store_words[current_rect].word[j] >= 65) && (store_words[current_rect].word[j] <= 90)) store_words[current_rect].word[j] += 32; }
void wxMacToolTip::Draw() { if ( m_label.Length() == 0 ) return ; if ( m_window == s_ToolTipWindowRef ) { m_shown = true ; #if TARGET_CARBON HMHelpContentRec tag ; tag.version = kMacHelpVersion; SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ; QDLocalToGlobalRect( GetWindowPort( m_window ) , &tag.absHotRect ) ; m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ; tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ; tag.tagSide = kHMDefaultSide; HMDisplayTag( &tag ); #else wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) ); FontFamilyID fontId ; Str255 fontName ; SInt16 fontSize ; Style fontStyle ; GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; GetFNum( fontName, &fontId ); TextFont( fontId ) ; TextSize( fontSize ) ; TextFace( fontStyle ) ; FontInfo fontInfo; ::GetFontInfo(&fontInfo); short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading; short height = 0 ; int i = 0 ; int length = m_label.Length() ; int width = 0 ; int thiswidth = 0 ; int laststop = 0 ; wxCharBuffer text = m_label.mb_str( wxConvLocal) ; while( i < length ) { if( text[i] == 13 || text[i] == 10) { thiswidth = ::TextWidth( text , laststop , i - laststop ) ; if ( thiswidth > width ) width = thiswidth ; height += lineh ; laststop = i+1 ; } i++ ; } if ( i - laststop > 0 ) { thiswidth = ::TextWidth( text , laststop , i - laststop ) ; if ( thiswidth > width ) width = thiswidth ; height += lineh ; } m_rect.left = m_position.x + kTipOffset; m_rect.top = m_position.y + kTipOffset; m_rect.right = m_rect.left + width + 2 * kTipBorder; m_rect.bottom = m_rect.top + height + 2 * kTipBorder; Rect r ; GetPortBounds( GetWindowPort( m_window ) , &r ) ; if ( m_rect.top < 0 ) { m_rect.bottom += -m_rect.top ; m_rect.top = 0 ; } if ( m_rect.left < 0 ) { m_rect.right += -m_rect.left ; m_rect.left = 0 ; } if ( m_rect.right > r.right ) { m_rect.left -= (m_rect.right - r.right ) ; m_rect.right = r.right ; } if ( m_rect.bottom > r.bottom ) { m_rect.top -= (m_rect.bottom - r.bottom) ; m_rect.bottom = r.bottom ; } ClipRect( &m_rect ) ; BackColor( whiteColor ) ; ForeColor(blackColor ) ; GWorldPtr port ; NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ; CGrafPtr origPort ; GDHandle origDevice ; GetGWorld( &origPort , &origDevice ) ; SetGWorld( port , NULL ) ; m_backpict = OpenPicture(&m_rect); CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), GetPortBitMapForCopyBits(port), &m_rect, &m_rect, srcCopy, NULL); ClosePicture(); SetGWorld( origPort , origDevice ) ; DisposeGWorld( port ) ; PenNormal() ; RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ; BackColor( whiteColor ) ; RGBForeColor( &tooltipbackground ) ; PaintRect( &m_rect ) ; ForeColor(blackColor ) ; FrameRect( &m_rect ) ; SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ; ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder); i = 0 ; laststop = 0 ; height = 0 ; while( i < length ) { if( text[i] == 13 || text[i] == 10) { ::DrawText( text , laststop , i - laststop ) ; height += lineh ; ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height ); laststop = i+1 ; } i++ ; } ::DrawText( text , laststop , i - laststop ) ; ::TextMode( srcOr ) ; #endif } }
static void draw_string(int x, int y, int width, int height, Str255 chars) { FontInfo info; GWorldPtr fromworld, toworld; CGrafPtr onport, saveport; GDHandle savedevice; int txFont, txFace, txSize; Rect fromrect, torect, onrect; PixMapHandle frompix, topix, onpix; int *from, *to, from_width, to_width; register int descent, w = 0, h = 0; register int i, j, ii = 0, jj = 0; if (p->path != 0) { GetFontInfo(&info); height += 8; descent = info.descent; switch (p->path) { case 1: x -= height-descent; y -= width; w = height; h = width; break; case 2: x -= width; y -= descent; w = width; h = height; break; case 3: x -= descent; w = height; h = width; break; } GetGWorld(&saveport, &savedevice); txFont = GetPortTextFont(saveport); txFace = GetPortTextFace(saveport); txSize = GetPortTextSize(saveport); onport = p->port; onpix = GetPortPixMap(onport); fromrect.left = 0; fromrect.right = width; fromrect.top = 0; fromrect.bottom = height; NewGWorld(&fromworld, 32, &fromrect, NULL, NULL, 0); SetGWorld(fromworld, NULL); frompix = GetGWorldPixMap(fromworld); from = (int *) GetPixBaseAddr(frompix); from_width = GetPixRowBytes(frompix) / 4; LockPixels(frompix); EraseRect(&fromrect); MoveTo(0, height - descent); TextFont(txFont); TextFace(txFace); TextSize(txSize); DrawString(chars); torect.left = 0; torect.right = w; torect.top = 0; torect.bottom = h; NewGWorld(&toworld, 32, &torect, NULL, NULL, 0); topix = GetGWorldPixMap(toworld); to = (int *) GetPixBaseAddr(topix); to_width = GetPixRowBytes(topix) / 4; LockPixels(topix); for (i = 0; i < width; i++) { for (j = 0; j < height; j++) { switch (p->path) { case 1: ii = j; jj = h - i - 1; break; case 2: ii = w - i - 1; jj = h - j - 1; break; case 3: ii = w - j - 1; jj = i; break; } to[jj * to_width + ii] = from[j * from_width + i]; } } UnlockPixels(topix); UnlockPixels(frompix); onrect.left = x; onrect.right = x + w; onrect.top = y; onrect.bottom = y + h; SetGWorld(saveport, savedevice); SetPort(onport); LockPixels(topix); CopyBits( (BitMap *) *topix, (BitMap *) *onpix, &torect, &onrect, srcOr, NULL); UnlockPixels(topix); DisposeGWorld(toworld); DisposeGWorld(fromworld); } else { MoveTo(x, y); DrawString(chars); } }
void draw_main_screen() { Rect source_rect, dest_rec,dest_rect; Rect reg_rect; SetPort(GetWindowPort(mainPtr)); tileImage(whole_win_rect,bg_gworld,bg[12]); // fill whole window with background texture dest_rec = source_rect = title_from; // initializes, to draw title // title_from is a Rect constant OffsetRect(&dest_rec,20,0); rect_draw_some_item (title_gworld,source_rect,dest_rec,(Point){0,0},transparent); // The first title_gworld is the from, the gworld to draw from // and source_rect is the rectangle in that gworld to draw // The 1,1 at the end means ... // the 1st 1 means transparent, if the first 1 was a 0, not transparent // The second 1 means on the main window, not into another gworld // dest_rec is where it's drawn to // Finally, the second title_gworld. This would be the gworld you were drawing into if // you were drawing into a gworld. You aren't so this doesn't matter, so just put the earlier // gworld in as a place holder. dest_rect = dest_rec; dest_rect.top = dest_rect.bottom; dest_rect.bottom = dest_rect.top + 50; // initialize rectangle to draw text into TextSize(12); TextFace(bold + underline); // set the pen //char_win_draw_string(GetWindowPort(mainPtr),dest_rect,"Characters",0,10); // This draws a chunk of text on the screen TextSize(10); /// reset text size TextFace(0); // reset text pen TextFace(bold); frame_dlog_rect(GetWindowPort(mainPtr),pc_info_rect,1); // draw the frame //i = pc_info_rect.left-pc_info_rect.right; //sprintf((char *)temp_str,"Width of pc_info_rect %d ", //(short) i); //win_draw_string(mainPtr,pc_info_rect,temp_str,0,12); dest_rect = pc_area_buttons[5][0]; dest_rect.right = whole_win_rect.right - 30; //What is this for? Commenting it out has no effect. dest_rect.left += 60; //Off0setRect(&dest_rect,0,45); OffsetRect(&dest_rect,0,21); if (file_in_mem == true) char_win_draw_string(mainPtr,dest_rect,"Click on character to edit it.",0,10); else char_win_draw_string(mainPtr,dest_rect,"Select Open from File menu.",0,10); if(file_in_mem == true && party_in_scen==true && scen_items_loaded==false){ OffsetRect(&dest_rect,200,0); char_win_draw_string(mainPtr,dest_rect,"Warning: Scenario item data could not be loaded.",0,10); OffsetRect(&dest_rect,-200,0); } OffsetRect(&dest_rect,0,12); if (file_in_mem == true) char_win_draw_string(mainPtr,dest_rect,"Press 'I' button to identify item, and 'D' button to drop item.",0,10); TextSize(12); OffsetRect(&dest_rect,0,16); if (file_in_mem == true) char_win_draw_string(mainPtr,dest_rect,"Back up save file before editing it!",0,10); TextSize(10); TextFace(0); OffsetRect(&dest_rect,280,0); char_win_draw_string(mainPtr,dest_rect,"Created in 1997 by Spiderweb Software, Inc.",0,10); TextFace(bold); reg_rect = whole_win_rect; reg_rect.left = reg_rect.right - 170; reg_rect.top += 8; reg_rect.right -= 3; }
void init_main_buttons() { short i; int indent = 0, indent2 = 0; GrafPtr old_port; Str255 fn1 = "\pGeneva"; Str255 fn3 = "\pPalatino"; Rect base_rect; if (init_once == false) { init_once = true; GetFNum(fn1,&geneva_font_num); if (geneva_font_num == 0) GetFNum(fn3,&geneva_font_num); GetPort(&old_port); SetPort(GetWindowPort(mainPtr)); TextFont(geneva_font_num); TextFace(bold); TextSize(10); SetPort(old_port); } //whole_win_rect = mainPtr->portRect; //Initialize pc_info_rect in center pc_info_rect= whole_win_rect; InsetRect(&pc_info_rect,100,100); pc_info_rect.bottom+=52; pc_info_rect.top-=25; pc_info_rect.right+=5; name_rect.left = pc_info_rect.left; name_rect.right = pc_info_rect.left + 100; name_rect.bottom = pc_info_rect.top + 15; name_rect.top = pc_info_rect.top; //Initialize pc_area_buttons pc_area_buttons[0][0].top=pc_info_rect.top; pc_area_buttons[0][0].bottom=pc_area_buttons[0][0].top + 56; for(i=0; i<6; i++) { pc_area_buttons[i][0].left = 20; pc_area_buttons[i][0].right = pc_area_buttons[0][0].left + 56; pc_area_buttons[i][2].left = 20; pc_area_buttons[i][2].right = pc_area_buttons[i][2].left + 56; pc_area_buttons[i][3].left = 20; pc_area_buttons[i][3].right = pc_area_buttons[i][3].left + 56; pc_area_buttons[i][1].left = 34; pc_area_buttons[i][1].right = pc_area_buttons[i][1].left + 28; pc_area_buttons[i][0].top = pc_area_buttons[0][0].top + 60*i; pc_area_buttons[i][0].bottom = pc_area_buttons[0][0].bottom + 60*i; pc_area_buttons[i][1].top = pc_area_buttons[i][0].top+2; pc_area_buttons[i][1].bottom = pc_area_buttons[i][2].top = pc_area_buttons[i][0].bottom - 18; pc_area_buttons[i][2].bottom = pc_area_buttons[i][3].top = pc_area_buttons[i][0].bottom - 9; pc_area_buttons[i][3].bottom = pc_area_buttons[i][0].bottom; OffsetRect(&pc_area_buttons[i][2],0,-1); OffsetRect(&pc_area_buttons[i][3],0,-2); } //Initialize the edit_rect buttons edit_rect[0][0].top = pc_info_rect.top; for(i = 0; i < 5; i++) { if(i >= 2) indent = 5; else indent = 0; if( i == 4) indent2 = 1; edit_rect[i][0].top = edit_rect[0][0].top + 66*i; edit_rect[i][0].bottom = edit_rect[i][0].top + 53; edit_rect[i][0].left = 510; edit_rect[i][0].right = edit_rect[i][0].left + 53; edit_rect[i][1].top = edit_rect[i][0].top + 11 + indent; edit_rect[i][1].bottom = edit_rect[i][0].bottom - 11 - indent; edit_rect[i][1].right = edit_rect[i][0].right - 8 +indent2; edit_rect[i][1].left = edit_rect[i][0].left + 8 + indent2; } // name_rect.left = pc_info_rect.left; // name_rect.right = pc_info_rect.left + (pc_info_rect.right - pc_info_rect.left)/4; // name_rect.bottom = pc_info_rect.top + 15; // name_rect.top = pc_info_rect.top; // if (name_rect.right == name_rect.left) { // SysBeep(50); SysBeep(50); // } //Initialize pc_race_rect pc_race_rect.top = pc_info_rect.top; pc_race_rect.bottom = name_rect.bottom; pc_race_rect.left = name_rect.right; pc_race_rect.right = pc_info_rect.left + (pc_info_rect.right - pc_info_rect.left)/2; //initialize info_area_rect info_area_rect.top = pc_info_rect.top; info_area_rect.left = pc_info_rect.left; info_area_rect.right = pc_race_rect.right; info_area_rect.bottom = pc_info_rect.bottom; /* if (name_rect.right == name_rect.left) { SysBeep(50); } */ // Initialize hp_sp_rect hp_sp_rect.top = name_rect.bottom + 1; hp_sp_rect.left = pc_info_rect.left + 1; hp_sp_rect.right = pc_race_rect.right; hp_sp_rect.bottom = hp_sp_rect.top + 12; // Initialize skill_rect skill_rect.top = hp_sp_rect.bottom + 2; skill_rect.left = pc_info_rect.left + 1; skill_rect.right = pc_race_rect.right; skill_rect.bottom = skill_rect.top + 12; //if (name_rect.right == name_rect.left) { // SysBeep(50); SysBeep(50); // } //Initialize skills_rect base_rect.top = skill_rect.bottom + 1; base_rect.left = skill_rect.left + 1; base_rect.right = name_rect.right - 1; base_rect.bottom = base_rect.top + (pc_info_rect.bottom - skill_rect.bottom)/30; for (i = 0; i < 19; i++) { pc_skills_rect[i] = base_rect; OffsetRect(&pc_skills_rect[i], (i / 10) * ((name_rect.right)-(name_rect.left)), (i % 10) * (pc_info_rect.bottom - name_rect.bottom)/30); } //Initialize status_rect status_rect.top = pc_skills_rect[9].bottom + 5; status_rect.left = pc_info_rect.left + 1; status_rect.right = pc_race_rect.right; status_rect.bottom = status_rect.top + 12; //Initialize pc_status_rect base_rect.top = status_rect.bottom + 1; base_rect.left = status_rect.left + 1; base_rect.right = name_rect.right - 1; base_rect.bottom = base_rect.top + (pc_info_rect.bottom - status_rect.bottom)/15; for (i = 0; i < 10; i++) { pc_status_rect[i] = base_rect; OffsetRect(&pc_status_rect[i], (i / 5) * ((name_rect.right)-(name_rect.left)), (i % 5) * (pc_info_rect.bottom - status_rect.bottom)/15); } //Initialize traits_rect traits_rect.top = pc_status_rect[4].bottom + 5; traits_rect.left = pc_info_rect.left + 1; traits_rect.right = pc_race_rect.right; traits_rect.bottom = traits_rect.top + 12; //Initialize pc_traits_rect base_rect.top = traits_rect.bottom - 1; base_rect.left = traits_rect.left + 1; base_rect.right = name_rect.right - 1; base_rect.bottom = base_rect.top + 10; for (i = 0; i < 16; i++) { pc_traits_rect[i] = base_rect; OffsetRect(&pc_traits_rect[i], (i / 8) * ((name_rect.right)-(name_rect.left)), (i % 8) * 9); } item_string_rects[0][0].top = pc_info_rect.top + 3; item_string_rects[0][0].left = pc_info_rect.left + (pc_info_rect.right - pc_info_rect.left)/2; item_string_rects[0][0].right = pc_info_rect.right; item_string_rects[0][0].bottom = item_string_rects[0][0].top + 12; for (i = 1; i < 24; i++) { item_string_rects[i][0] = item_string_rects[0][0]; OffsetRect(&item_string_rects[i][0],0,13 * i); } for (i = 0; i < 24; i++) { item_string_rects[i][1] = item_string_rects[i][0]; item_string_rects[i][1].right -= 14; item_string_rects[i][1].left = item_string_rects[i][1].right - 14; item_string_rects[i][2] = item_string_rects[i][0]; item_string_rects[i][2].left = item_string_rects[i][2].right - 14; } }
void display_party(short mode,short clear_first) //short mode; // 0 - 5 this pc, 6 - all //short clear_first; // 1 - redraw over what's already there, 0 - don't redraw over { short i,k,string_num, cur_rect=0; Str255 to_draw, skill_value; Rect from_base = {0,0,36,28},from_rect,no_party_rect,temp_rect; // lots of stuff is global. Like ... // bool file_in_mem // short current_active_pc if (clear_first == 1) { // first erase what's already there for (i = 0; i < 6; i++) tileImage(pc_area_buttons[i][0],bg_gworld,bg[12]); tileImage(name_rect,bg_gworld,bg[12]); tileImage(pc_race_rect,bg_gworld,bg[12]); tileImage(info_area_rect,bg_gworld,bg[12]); frame_dlog_rect(GetWindowPort(mainPtr),pc_info_rect,1); // re-draw the frame } if (file_in_mem == false) { // what if no party loaded? no_party_rect=pc_info_rect; no_party_rect.top+=5; no_party_rect.left+=5; char_win_draw_string(mainPtr,no_party_rect,"No party loaded.",0,10); } else { from_rect = pc_info_rect; from_rect.top = from_rect.bottom - 14; if (party_in_scen == false) char_win_draw_string(mainPtr,from_rect,"Party not in a scenario.",0,10); else char_win_draw_string(mainPtr,from_rect,"Party is in a scenario.",0,10); for (i = 0; i < 6; i++) { if (i == current_active_pc) // active pc is drawn in blue ForeColor(blueColor); else ForeColor(blackColor); from_rect = (current_pressed_button == i) ? ed_buttons_from[1] : ed_buttons_from[0]; if ((current_pressed_button < 0) || (current_pressed_button == i)) rect_draw_some_item(buttons_gworld,from_rect,pc_area_buttons[i][0],(Point){0,0}); ForeColor(blackColor); // pc_record_type is the records that contains chaarcters // main_status determins 0 - not exist, 1 - alive, OK, 2 - dead, 3 - stoned, 4 - dust if (univ.party[i].main_status != 0) { // PC exists? from_rect = from_base; // draw PC graphic OffsetRect(&from_rect,56 * (univ.party[i].which_graphic / 8),36 * (univ.party[i].which_graphic % 8)); rect_draw_some_item(pc_gworld,from_rect,pc_area_buttons[i][1],(Point){0,0},transparent); //frame_dlog_rect(GetWindowPort(mainPtr),pc_area_buttons[i][1],0); // draw name TextSize(9); if( (univ.party[i].name.length()) >= 10) { TextFace(0); sprintf((char *) to_draw, "%-s ", (char *) univ.party[i].name.c_str()); TextSize(6); } else { sprintf((char *) to_draw, "%-s ", (char *) univ.party[i].name.c_str()); } ForeColor(whiteColor); win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][2],to_draw,1,10); TextFace(bold); TextSize(10); if (i == current_active_pc){ sprintf((char *) to_draw, "%-.18s ", (char *) univ.party[i].name.c_str()); if( (univ.party[i].name.length()) > 12) TextSize(8); ForeColor(blackColor); win_draw_string(GetWindowPort(mainPtr),name_rect,to_draw,1,10); TextSize(10); } if ((current_pressed_button < 0) || (current_pressed_button == i)) switch (univ.party[i].main_status) { // draw statistics case 1: if (i == current_active_pc) { //Draw in race if (univ.party[i].race == 0) char_win_draw_string(mainPtr,pc_race_rect,"Human ",1,10); if (univ.party[i].race == 1) char_win_draw_string(mainPtr,pc_race_rect,"Nephilim ",1,10); if (univ.party[i].race == 2) char_win_draw_string(mainPtr,pc_race_rect,"Slithzerikai ",1,10); // Draw in skills sprintf((char *) to_draw, "Skills:"); win_draw_string(GetWindowPort(mainPtr),skill_rect,to_draw,0,10); sprintf((char *) to_draw, "Hp: %d/%d Sp: %d/%d",univ.party[i].cur_health,univ.party[i].max_health,univ.party[i].cur_sp, univ.party[i].max_sp); win_draw_string(GetWindowPort(mainPtr),hp_sp_rect,to_draw,0,10); TextSize(9); TextFace(0); string_num=1; for( k = 0; k < 19 ; ++k) { temp_rect = pc_skills_rect[k]; temp_rect.left = pc_skills_rect[k].left + 80; get_str(to_draw,9,string_num); win_draw_string(GetWindowPort(mainPtr),pc_skills_rect[k],to_draw,0,9); sprintf((char *) skill_value,"%d",univ.party[i].skills[k]); win_draw_string(GetWindowPort(mainPtr),temp_rect,skill_value,0,9); //frame_dlog_rect(GetWindowPort(mainPtr),pc_skills_rect[k],0); string_num+=2; } //end skills //Write in pc Status TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Status:"); win_draw_string(GetWindowPort(mainPtr),status_rect,to_draw,0,10); TextSize(9); TextFace(0); //for(k = 0 ; k < 10; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_status_rect[k],0); if (univ.party[i].status[0] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned Weap.",0,9); cur_rect++; } if (univ.party[i].status[1] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Blessed",0,9); cur_rect++; } else if(univ.party[i].status[1] < 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Cursed",0,9); cur_rect++; } if (univ.party[i].status[2] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned",0,9); cur_rect++; } if (univ.party[i].status[3] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Hasted",0,9); cur_rect++; } else if(univ.party[i].status[3] < 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Slowed",0,9); cur_rect++; } if (univ.party[i].status[4] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Invulnerable",0,9); cur_rect++; } if (univ.party[i].status[5] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Magic Resistant",0,9); cur_rect++; } if (univ.party[i].status[6] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Webbed",0,9); cur_rect++; } if (univ.party[i].status[7] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Diseased",0,9); cur_rect++; } if (univ.party[i].status[8] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Sanctury",0,9); cur_rect++; } if (univ.party[i].status[9] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Dumbfounded",0,9); cur_rect++; } if (univ.party[i].status[10] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Martyr's Shield",0,9); cur_rect++; } if (univ.party[i].status[11] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Asleep",0,9); cur_rect++; } if (univ.party[i].status[12] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Paralyzed",0,9); cur_rect++; } if (univ.party[i].status[13] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Acid",0,9); cur_rect++; } //end pc status section //Write in Traits TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Traits:"); win_draw_string(GetWindowPort(mainPtr),traits_rect,to_draw,0,10); //for(k = 0 ; k < 16; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_traits_rect[k],0); TextSize(9); TextFace(0); cur_rect=0; if (univ.party[i].traits[0] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Toughness",0,9); cur_rect++; } if (univ.party[i].traits[1] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Apt",0,9); cur_rect++; } if (univ.party[i].traits[2] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Ambidextrous",0,9); cur_rect++; } if (univ.party[i].traits[3] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Nimble Fingers",0,9); cur_rect++; } if (univ.party[i].traits[4] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Cave Lore",0,9); cur_rect++; } if (univ.party[i].traits[5] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Woodsman",0,9); cur_rect++; } if (univ.party[i].traits[6] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Good Constitution",0,9); cur_rect++; } if (univ.party[i].traits[7] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Highly Alert",0,9); cur_rect++; } if (univ.party[i].traits[8] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Exceptional Str.",0,9); cur_rect++; } if (univ.party[i].traits[9] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Recuperation",0,9); cur_rect++; } if (univ.party[i].traits[10] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Sluggish",0,9); cur_rect++; } if (univ.party[i].traits[11] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Inept",0,9); cur_rect++; } if (univ.party[i].traits[12] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Frail",0,9); cur_rect++; } if (univ.party[i].traits[13] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Chronic Disease",0,9); cur_rect++; } if (univ.party[i].traits[14] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Bad Back",0,9); cur_rect++; } //end traits } ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Alive ",1,10); TextFace(bold); TextSize(10); break; case 2: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dead ",1,10); TextFace(bold); TextSize(10); break; case 3: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dust ",1,10); TextFace(bold); TextSize(10); break; case 4: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Stone ",1,10); TextFace(bold); TextSize(10); break; case 5: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Fled ",1,10); TextFace(bold); TextSize(10); break; case 6: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Surface ",1,10); TextFace(bold); TextSize(10); break; default: ForeColor(whiteColor); TextFace(0); TextSize(9); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Absent ",1,10); TextFace(bold); TextSize(10); break; } //frame_dlog_rect(GetWindowPort(mainPtr),pc_area_buttons[i][0],0); } } // Closes the for i=6 loop ForeColor(blackColor); for(i = 0; i < 5; i++) if ((current_pressed_button < 0) || (current_pressed_button == i + 10)) { if (clear_first == 1) { // first erase what's already there tileImage(edit_rect[i][0],bg_gworld,bg[12]); } //frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][0],0); //frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][1],0); from_rect = (current_pressed_button == i + 10) ? ed_buttons_from[1] : ed_buttons_from[0]; rect_draw_some_item(buttons_gworld,from_rect,edit_rect[i][0],(Point){0,0}); ForeColor(whiteColor); switch(i) { case 0: char_win_draw_string(mainPtr,edit_rect[0][1]," Add Mage Spells ",0,10); break; case 1: char_win_draw_string(mainPtr,edit_rect[1][1]," Add Priest Spells ",0,10); break; case 2: char_win_draw_string(mainPtr,edit_rect[2][1]," Edit Traits",0,10); break; case 3: char_win_draw_string(mainPtr,edit_rect[3][1]," Edit Skills",0,10); break; case 4: char_win_draw_string(mainPtr,edit_rect[4][1]," Edit XP",0,10); break; default: break; } ForeColor(blackColor); } // MoveTo(start_h + 10, start_v + 127); // sprintf((char *) to_draw, " Gold: %d Food: %d ",(short) party.gold, (short) party.food); // DrawString(to_draw); } ForeColor(blackColor); }