//无用 HFONT FNT_SetFont(LPCTSTR face, int h, int w) { HFONT hFont; hFont = CreateFont(h, 0, 0, 0, w, FALSE, FALSE, FALSE, DEFAULT_CHARSET/*SHIFTJIS_CHARSET*/, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH | FF_MODERN, face); if (hFont == NULL) { DebugBox(NULL, "フォント作成に失敗しました"); } return hFont; }
void SAV_Save( int save_no ) { char fname[256]; SAV_CreateSaveHead(); SAV_SaveScript(); CopyMemory( SaveStruct.ESC_FlagBuf, ESC_FlagBuf, sizeof(int)*ESC_FLAG_MAX ); AVG_SetSaveData( &SaveStruct.sdata ); if(save_no>=0) { wsprintf( fname, "save_%02d.sav", save_no ); } else { wsprintf( fname, "save___.sav" ); } if( !STD_WriteFile( fname, (char*)&SaveStruct, sizeof(SaveStruct)) ){ DebugBox( NULL, "ファイルが開けないにょ[%s]", fname ); } }
void SAV_Load( int load_no ) { char fname[256]; if(load_no>=0) { wsprintf( fname, "save_%02d.sav", load_no ); } else { wsprintf( fname, "save___.sav" ); } if( !STD_ReadFile( fname, (char*)&SaveStruct, sizeof(SaveStruct)) ){ DebugBox( NULL, "ファイルが開けないにょ[%s]", fname ); } SAV_LoadScript(); CopyMemory( ESC_FlagBuf, SaveStruct.ESC_FlagBuf, sizeof(int)*ESC_FLAG_MAX ); DefaultCharName = ESC_GetFlag( _DEFAULT_NAME ); AVG_SetLoadData( SaveStruct.sdata ); AVG_LoadWindow(); }
BOOL PAC_PackFileMovie_Close( int move_no ) { if(MoveInfo[move_no].buf){ MoveInfo[move_no].buf = (BYTE *)GlobalFree( MoveInfo[move_no].buf ); } if(MoveInfo[move_no].fh){ if( CloseHandle( MoveInfo[move_no].fh ) ){ MoveInfo[move_no].fh = NULL; }else{ DebugBox( NULL,"動画ファイルが閉じません"); } } ZeroMemory( &MoveInfo[move_no], sizeof(MOVE_INFO) ); MoveInfo[move_no].r = 128; MoveInfo[move_no].g = 128; MoveInfo[move_no].b = 128; return TRUE; }
// チェックポイントから現在の差分をとって、リークしていればダンプする void MemoryLeakDetection::dump() const { _CrtMemState stateNow; _CrtMemState stateDiff; // 現在のチェックポイントとの差分を取得 _CrtMemCheckpoint(&stateNow); _CrtMemDifference(&stateDiff, &mem_state_, &stateNow); // ノーマルブロックかクライアントブロックの数が0より大きければ、 // リークが起きている if (stateDiff.lCounts[_NORMAL_BLOCK] > 0 || stateDiff.lCounts[_CLIENT_BLOCK] > 0) { if (is_break_) { DebugBox("Memory Leak Detected!!"); } DebugTrace("Checkpoint:\n%s(%d)\n", p_file_, line_); _CrtMemDumpAllObjectsSince(&mem_state_); DebugBreakIf(is_break_); } else { DebugTrace("No Memory Leaks. Checkpoint:\n%s(%d)\n", p_file_, line_); } }
int PAC_PackFileMovie_Open( char *PackFname ) { int i; int size; for(i=0;i<32;i++){ if(!MoveInfo[i].fh) break; } if(i==32) return -1; PAC_PackFileMovie_Close( i ); MoveInfo[i].fh = CREATE_READ_FILE2( PackFname, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN ); if( MoveInfo[i].fh==INVALID_HANDLE_VALUE ){ MoveInfo[i].fh=NULL; DebugBox(NULL,"動画ファイルオープン失敗[%s]",PackFname); return -2; } ReadFile( MoveInfo[i].fh, &MoveInfo[i].bmi, sizeof(BMP_MOVE_INFO), (unsigned long *)&size, NULL); ReadFile( MoveInfo[i].fh, MoveInfo[i].next_size, sizeof(DWORD)*2, (unsigned long *)&size, NULL); if(MoveInfo[i].buf) MoveInfo[i].buf = (BYTE *)GlobalFree( MoveInfo[i].buf ); MoveInfo[i].buf = (BYTE *)GlobalAlloc( GPTR, MoveInfo[i].bmi.sx*MoveInfo[i].bmi.sy + 1024 + 8 ); MoveInfo[i].db_buf = 0; MoveInfo[i].count = 0; MoveInfo[i].start_time = 0; MoveInfo[i].cond = MOVE_COND_STOP; MoveInfo[i].loop = 1; MoveInfo[i].r = 128; MoveInfo[i].g = 128; MoveInfo[i].b = 128; return i; }
void ShowInfoText() { DebugBox frameInfo = DebugBox(Vec2i(10, 10), "FrameInfo"); frameInfo.add("Platform time", prettyUs(toUs(g_platformTime.frameStart()))); frameInfo.add("Game time", prettyUs(toUs(g_gameTime.now()))); frameInfo.add("Prims", EERIEDrawnPolys); frameInfo.add("Particles", getParticleCount()); frameInfo.add("Sparks", ParticleSparkCount()); frameInfo.add("Polybooms", long(PolyBoomCount())); frameInfo.print(); DebugBox camBox = DebugBox(Vec2i(10, frameInfo.size().y + 5), "Camera"); camBox.add("Position", g_camera->m_pos); camBox.add("Rotation", g_camera->angle); camBox.add("Focal", g_camera->focal); camBox.print(); DebugBox playerBox = DebugBox(Vec2i(10, camBox.size().y + 5), "Player"); playerBox.add("Position", player.pos); playerBox.add("Rotation", player.angle); playerBox.add("Velocity", player.physics.velocity); EERIEPOLY * ep = CheckInPoly(player.pos); float truePolyY = -666.66f; if(ep) { float tempY = 0.f; if(GetTruePolyY(ep, player.pos, &tempY)) { truePolyY = tempY; } } ep = CheckInPoly(player.pos + Vec3f(0.f, -10.f, 0.f)); float slope = 0.f; if(ep) slope = ep->norm.y; long zap = IsAnyPolyThere(player.pos.x, player.pos.z); playerBox.add("Ground Slope", slope); playerBox.add("Ground truePolyY", truePolyY); playerBox.add("Ground POLY", zap); playerBox.add("Color", CURRENT_PLAYER_COLOR); playerBox.add("Stealth", GetPlayerStealth()); playerBox.add("Jump", player.jumplastposition); playerBox.add("OFFGRND", (!player.onfirmground ? "OFFGRND" : "")); playerBox.add("Life", player.lifePool); playerBox.add("Mana", player.manaPool); playerBox.add("Poisoned", player.poison); playerBox.add("Hunger", player.hunger); playerBox.add("Magic", static_cast<long>(player.doingmagic)); playerBox.print(); DebugBox miscBox = DebugBox(Vec2i(10, playerBox.size().y + 5), "Misc"); miscBox.add(arx_name + " version", arx_version); miscBox.add("Level", LastLoadedScene.string()); miscBox.add("Spell failed seq", LAST_FAILED_SEQUENCE); miscBox.add("Cinema", cinematicBorder.CINEMA_DECAL); miscBox.add("Mouse", Vec2i(DANAEMouse)); miscBox.add("Pathfind queue", EERIE_PATHFINDER_Get_Queued_Number()); miscBox.add("Pathfind status", EERIE_PATHFINDER_Is_Busy() ? "Working" : "Idled"); miscBox.print(); { struct ScriptDebugReport { std::string entityName; long events; long sends; ScriptDebugReport() : entityName("") , events(0) , sends(0) {} }; ScriptDebugReport maxEvents; Entity * io = ARX_SCRIPT_Get_IO_Max_Events(); if(io) { maxEvents.entityName = io->idString(); maxEvents.events = io->stat_count; } ScriptDebugReport maxSender; io = ARX_SCRIPT_Get_IO_Max_Events_Sent(); if(io) { maxSender.entityName = io->idString(); maxSender.sends = io->stat_sent; } DebugBox scriptBox = DebugBox(Vec2i(10, miscBox.size().y + 5), "Script"); scriptBox.add("Events", ScriptEvent::totalCount); scriptBox.add("Timers", ARX_SCRIPT_CountTimers()); scriptBox.add("Max events", maxEvents.entityName); scriptBox.add("Max events#", maxEvents.events); scriptBox.add("Max sender", maxSender.entityName); scriptBox.add("Max sender#", maxSender.sends); scriptBox.print(); } Entity * io = entities.get(LastSelectedIONum); if(io) { DebugBox entityBox = DebugBox(Vec2i(500, 10), "Entity " + io->idString()); entityBox.add("Pos", io->pos); entityBox.add("Angle", io->angle); entityBox.add("Room", static_cast<long>(io->room)); entityBox.add("Move", io->move); entityBox.add("Flags", flagNames(EntityFlagNames, io->ioflags)); entityBox.add("GFlags", flagNames(GameFlagNames, io->gameFlags)); entityBox.add("Show", entityVisilibityToString(io->show)); entityBox.print(); if(io->ioflags & IO_NPC) { IO_NPCDATA * npcData = io->_npcdata; DebugBox npcBox = DebugBox(Vec2i(500, entityBox.size().y + 5), "NPC"); npcBox.add("Life", npcData->lifePool); npcBox.add("Mana", npcData->manaPool); npcBox.add("Poisoned", npcData->poisonned); npcBox.add("ArmorClass", ARX_INTERACTIVE_GetArmorClass(io)); npcBox.add("Absorb", npcData->absorb); npcBox.add("Moveproblem", npcData->moveproblem); npcBox.add("Pathfind listpos", static_cast<long>(npcData->pathfind.listpos)); npcBox.add("Pathfind listnb", npcData->pathfind.listnb); npcBox.add("Pathfind targ", npcData->pathfind.truetarget.handleData()); npcBox.add("Behavior", flagNames(BehaviourFlagNames, npcData->behavior)); // TODO should those really be flags ? PathfindFlags pflag = io->_npcdata->pathfind.flags; std::string pflags; if(pflag & PATHFIND_ALWAYS) pflags += "ALWAYS "; if(pflag & PATHFIND_ONCE) pflags += "ONCE "; if(pflag & PATHFIND_NO_UPDATE) pflags += "NO_UPDATE "; npcBox.add("Pathfind flgs", pflags); npcBox.print(); } if(io->ioflags & (IO_FIX | IO_ITEM)) { DebugBox itemBox = DebugBox(Vec2i(500, entityBox.size().y + 5), "Item"); itemBox.add("Durability", io->durability); itemBox.add("Durability max", io->max_durability); itemBox.add("Poisonous", static_cast<long>(io->poisonous)); itemBox.add("Poisonous count", static_cast<long>(io->poisonous_count)); itemBox.print(); } long column2y = 400; for(size_t i = 0; i < MAX_ANIM_LAYERS; i++) { AnimLayer & layer = io->animlayer[i]; DebugBox animLayerBox = DebugBox(Vec2i(500, column2y), str(boost::format("Anim Layer %1%") % i)); animLayerBox.add("ctime", long(layer.ctime.t)); animLayerBox.add("flags", flagNames(AnimUseFlagNames, layer.flags)); animLayerBox.add("currentFrame", layer.currentFrame); if(layer.cur_anim) { animLayerBox.add("cur_anim", layer.cur_anim->path.string()); } else { animLayerBox.add("cur_anim", "none"); } animLayerBox.print(); column2y = animLayerBox.size().y + 5; } } ARX_SCRIPT_Init_Event_Stats(); }
BOOL CMovPlayerFrm::OpenMovie( HWND hWnd, char *fname, int x, int y, int w, int h ) { m_hWnd = hWnd; wX = x; wY = y; wWidth = w; wHeight = h; ofi = PAC_OpenFileHandle( "mov", fname, &fh ); if(fh==NULL)DebugBox( NULL, "ファイルが見つかりませんでした。(%s)", fname); Chunk aviFileHead; Chunk aviInfo; AVIMAINHEADER aviMainHead; PAC_ReedFileHandle( &fh, &ofi, (BYTE*)&aviFileHead, sizeof(Chunk) ); if(MAKEFOURCC('R','I','F','F')!=aviFileHead.ckID){ PAC_OpenFileHandle( &fh ); return FALSE; } PAC_ReedFileHandle( &fh, &ofi, (BYTE*)&aviInfo, sizeof(Chunk) ); PAC_ReedFileHandle( &fh, &ofi, (BYTE*)&aviMainHead, sizeof(AVIMAINHEADER) ); fpms = aviMainHead.dwMicroSecPerFrame; srcWidth = aviMainHead.dwWidth; srcHeight = aviMainHead.dwHeight; HDC hDC = ::GetDC(m_hWnd); HBRUSH brush = CreateSolidBrush(RGB(0, 0, 8)); HBRUSH old_brush = (HBRUSH)SelectObject(hDC,brush); PatBlt(hDC,0,0, 800, 600, PATCOPY); SelectObject(hDC,old_brush); DeleteObject(brush); ::ReleaseDC(m_hWnd,hDC); if(FALSE == CreateSurface() ){ BITMAPINFOHEADER bmpInfo; ZeroMemory(&bmpInfo,sizeof(BITMAPINFOHEADER)); bmpInfo.biSize = sizeof(BITMAPINFOHEADER); bmpInfo.biPlanes = 1; bmpInfo.biBitCount = 24; bmpInfo.biCompression = BI_RGB; bmpInfo.biWidth = srcWidth; bmpInfo.biHeight = -srcHeight; bmpInfo.biSizeImage = srcWidth * srcHeight *3; hDC = ::GetDC(m_hWnd); memDC = CreateCompatibleDC(hDC); hBmp = CreateDIBSection(hDC,(BITMAPINFO *)&bmpInfo,DIB_RGB_COLORS,(void **)&pBuffer,NULL,NULL); oldBmp = (HBITMAP)SelectObject(memDC,hBmp); ::ReleaseDC(m_hWnd,hDC); } buffer_size = srcWidth*srcHeight*2; readBuf = (LPBYTE)malloc(buffer_size); xvidDec.Start_XviD(srcWidth,srcHeight,overlay_forcc[forccNum]); read_size = PAC_ReedFileHandle( &fh, &ofi, readBuf, buffer_size ); frame_cnt = 0; old_frame = 0; start_time = 0; old_time = 0; skip_cnt = 0; total_skip_cnt = 0; bPause = FALSE; bEnd = FALSE; MovPlaying2 = TRUE; return TRUE; }
int TXT_DrawTextEx( void *dest, int draw_mode2, int sx, int sy, int w, int h, int pixh_w, int pich_h, int *px2, int *py2, RECT *clip, int font, char *str, int color, int text_cnt, int step_cnt, int r, int g, int b, int alph, int kage, int cnt_flag, char *normal_str, int kaigyou_musi ) { int digit; int px = sx, py = sy; int cnt = 0; int cnt2 = 0; int kflag = 0; int cno = color; int fno = font&0xff, fno2 = font&0xff; int tag_cnt = 0; int tag_param[16]; int tag_back[16]; int draw_flag=0; int accent_flag=0; char rubi_str[64]; RGB32 rgb; int rfno = 16; int alph2=alph; int wait=0; int speed=10; int step=0; int end_flag=0; int amari=0; int kaig=0; int px_bak=0; int hankaku_err=0; static int hankaku_err_flag=0; if(font&0xff00 && hankaku_err_flag==0){ hankaku_err_flag=1; hankaku_err=1; } font = font&0xff; enum{ TAG_DIGIT, TAG_COLOR, TAG_FONT, TAG_RUBI, TAG_ACCENT, TAG_SPEED, TAG_WAIT, }; TXT_GetMsgSpeed( -1 ); if(str==NULL){ return 0; } while( cnt2 < text_cnt || text_cnt==-1 || ( cnt2==text_cnt && !amari) ) { amari = TXT_GetMsgSpeed(-2); if(wait){ wait--; cnt2++; continue; } if(alph==-1){ if(text_cnt==-1){ alph2 = 256; } else { alph2 = LIM(text_cnt-cnt2, 0, 16)*16; } if(step<step_cnt){ alph2 = 256; } } switch( str[cnt] ){ case '\0': if( tag_cnt ){ DebugBox( NULL, "�^�O���J�����܂܂ɂȂ��Ă��܂��B�K�����Ă�������" ); } end_flag=1; break; case '\n': if(!kaig){ px_bak=px; px = sx; py += fno2+pich_h; fno2 = fno; if(normal_str) { *normal_str = '\n'; normal_str++; } } kaig=0; break; case '^': draw_flag = 1; str[cnt] = ' '; break; case '~': str[cnt] = ','; draw_flag = 1; break; case '\\': cnt++; switch( str[cnt] ){ case 'n': if(!kaig){ px_bak=px; px = sx; py += fno2+pich_h; fno2 = fno; if(normal_str) { *normal_str = '\n'; normal_str++; } } kaig=0; break; case 'k': if(step>=step_cnt && step_cnt!=-1 ){ end_flag=1; } step++; break; case '^': case '~': case '<': case '>': case '|': case '\\': draw_flag = 1; break; } break; case '<': cnt++; if( tag_cnt >= 15 ){ DebugBox( NULL, "�^�O���J���߂��ł��B�l�`�w �P�T" ); break; } switch( str[cnt] ){ case 'd': case 'D': tag_param[tag_cnt] = TAG_DIGIT; tag_back[tag_cnt] = 0; tag_cnt++; cnt++; if( GetDigit( str, &cnt, &digit ) ){ } break; case 'c': case 'C': tag_param[tag_cnt] = TAG_COLOR; tag_back[tag_cnt] = cno; tag_cnt++; cnt++; if( GetDigit( str, &cnt, &digit ) ){ cno = digit; } break; case 'f': case 'F': tag_param[tag_cnt] = TAG_FONT; tag_back[tag_cnt] = fno; tag_cnt++; cnt++; if( GetDigit( str, &cnt, &digit ) ){ fno = digit; fno2 = max(fno,fno2); } break; case 'r': case 'R': tag_param[tag_cnt] = TAG_RUBI; tag_back[tag_cnt] = px; tag_cnt++; break; case 'a': case 'A': tag_param[tag_cnt] = TAG_ACCENT; tag_cnt++; accent_flag = 1; break; case 's': case 'S': tag_param[tag_cnt] = TAG_SPEED; tag_back[tag_cnt] = speed; tag_cnt++; cnt++; if( GetDigit( str, &cnt, &digit ) ){ switch(digit){ case 0: speed = 100;break; case 1: speed = 80; break; case 2: speed = 60; break; case 3: speed = 40; break; case 4: speed = 20; break; case 5: speed = 10; break; case 6: speed = 6; break; case 7: speed = 4; break; case 8: speed = 2; break; case 9: speed = 1; break; case 10:speed = 0; break; } } break; case 'w': case 'W': tag_param[tag_cnt] = TAG_WAIT; tag_back[tag_cnt] = 0; tag_cnt++; cnt++; if( GetDigit( str, &cnt, &digit ) ){ wait = digit*2; } break; } break; case '|': cnt++; switch(tag_param[tag_cnt-1]){ case TAG_RUBI: { int i=0,rx,pw=0; while(str[cnt]!='>'){ rubi_str[i++] = str[cnt++]; } rubi_str[i] = '\0'; rgb = BMP_ChangeBright_Full( FCT[cno], r, g, b ); rx = ((px-tag_back[tag_cnt-1]) - i*rfno/2)/2; if(rx<=0){ pw=0; }else{ if( (0x21 <= rubi_str[0] && rubi_str[0] <= 0x7e) || (0xa1 <= rubi_str[0] && rubi_str[0] <= 0xdf) ){ pw = rx*2/(i); }else{ pw = rx*2/(i/2); } rx = pw/2; } rx = tag_back[tag_cnt-1]+rx; if(!cnt_flag) FNT_DrawText( dest, draw_mode2, rx, py-rfno-1,pw,0, rubi_str, rfno, clip, rgb.r, rgb.g, rgb.b, alph2, (kage)?kage-1:0 ); } cnt--; break; } break; case '>': if( tag_cnt <= 0 ){ DebugBox( NULL, "���^�O( > )�̐����A�J��������葽���Ȃ��Ă��܂�" ); break; } tag_cnt--; if(!TH2_Flag){ switch( tag_param[tag_cnt] ){ case TAG_DIGIT: break; case TAG_COLOR: cno = tag_back[tag_cnt]; break; case TAG_FONT: fno = tag_back[tag_cnt]; if(px==sx){ fno2 = fno; }else{ fno2 = max(fno,fno2); } break; case TAG_RUBI: break; case TAG_ACCENT: accent_flag = 0; break; case TAG_SPEED: speed = tag_back[tag_cnt]; break; case TAG_WAIT: break; } } break; default: draw_flag = 1; break; } if(draw_flag){ draw_flag = 0; rgb = BMP_ChangeBright_Full( FCT[cno], r, g, b ); if( (0x00<=str[cnt] && str[cnt]<0x80) || (0xa0<=str[cnt] && str[cnt]<0xe0) ) { if(normal_str) { *normal_str = str[cnt]; normal_str++; } if(!cnt_flag) FNT_DrawChar( dest, draw_mode2, px, py, str[cnt], fno, clip, rgb.r, rgb.g, rgb.b, alph2, kage, 1 ); cnt2 += TXT_GetMsgSpeed( speed ); if(accent_flag){ if(!cnt_flag) FNT_DrawChar( dest, draw_mode2, px+(fno-rfno/2)/2, py-rfno+1, '�', rfno, clip, rgb.r, rgb.g, rgb.b, alph2, (kage)?kage-1:0, 1 ); } px += fno/2+pixh_w; kaig=0; if(hankaku_err){ DebugBox( NULL, "ToHert2�ł͔��p������͎g�p�ł��܂���I" ); } }else{ if(normal_str) { *(WORD*)normal_str = *(WORD*)&str[cnt]; normal_str+=2; } if(!cnt_flag) FNT_DrawChar( dest, draw_mode2, px, py, *(WORD*)&str[cnt], fno, clip, rgb.r, rgb.g, rgb.b, alph2, kage, 0 ); cnt++; cnt2 += TXT_GetMsgSpeed( speed ); if(accent_flag){ if(!cnt_flag) FNT_DrawChar( dest, draw_mode2, px+(fno-rfno/2)/2, py-rfno+1, '�', rfno, clip, rgb.r, rgb.g, rgb.b, alph2, (kage)?kage-1:0, 1 ); } px += fno+pixh_w; kaig=0; } } if(end_flag)break; cnt++; if( px-sx >= w*font-fno+1 ){ if( tag_param[tag_cnt-1]!=TAG_RUBI ){ if( kflag==1 ){ if( strncmp( &str[ cnt ], "�@", 2 ) ) { kflag = 0; px_bak = px; px = sx; py += fno2+pich_h; fno2 = fno; kaig=1; } }else{ if( strncmp( &str[ cnt ], "�B", 2 ) && strncmp( &str[ cnt ], "�A", 2 ) && strncmp( &str[ cnt ], "�C", 2 ) && strncmp( &str[ cnt ], "�D", 2 ) && strncmp( &str[ cnt ], "�E", 2 ) && strncmp( &str[ cnt ], "�c", 2 ) && strncmp( &str[ cnt ], "�[", 2 ) && strncmp( &str[ cnt ], "�[", 2 ) && strncmp( &str[ cnt ], "�F", 2 ) && strncmp( &str[ cnt ], "�G", 2 ) && strncmp( &str[ cnt ], "�H", 2 ) && strncmp( &str[ cnt ], "�I", 2 ) && strncmp( &str[ cnt ], "�n", 2 ) && strncmp( &str[ cnt ], "�h", 2 ) && strncmp( &str[ cnt ], "�@", 2 ) && strncmp( &str[ cnt ], "�j", 2 ) && strncmp( &str[ cnt ], "�v", 2 ) && strncmp( &str[ cnt ], "�x", 2 ) && strncmp( &str[ cnt ], "�D", 2 ) && strncmp( &str[ cnt ], "�C", 2 ) && strncmp( &str[ cnt ], "�B", 2 ) && strncmp( &str[ cnt ], "�A", 2 ) && strncmp( &str[ cnt ], "�F", 2 ) && strncmp( &str[ cnt ], "�F", 2 ) && strncmp( &str[ cnt ], "�G", 2 ) && strncmp( &str[ cnt ], "�E", 2 ) && strncmp( &str[ cnt ], "�@", 2 ) ) { px_bak = px; px = sx; py += fno2+pich_h; fno2 = fno; kaig=1; }else{ kflag=1; } } } } if( py-sy >= h*(font+pich_h)-(fno+pich_h)+1 ){ static int err=0; if( py-sy==h*(font+pich_h) && px==sx ){ }else{ if(err==0){ err=1; } break; } } } if(px2){ if(kaigyou_musi){ *px2=px; if(py2) *py2 = py; }else{ if(px==sx && py!=sy && (px_bak-sx <= w*font) ){ *px2=px_bak; if(py2) *py2 = py- (fno2+pich_h); }else{ *px2=px; if(py2) *py2 = py; } } }else{ if(py2) *py2 = py; } return (cnt_flag) ? cnt2 : (px==sx)? py-sy : py-sy+fno; }
int D3DM_InitDevices( HWND hwnd, int w, int h, int full, HMENU menu ) { char buf[256]; int i,j; LPDIRECTDRAW7 pDD = NULL; HRESULT hr; if( FAILED( hr = DirectDrawCreateEx( NULL, (VOID**)&pDD, IID_IDirectDraw7, NULL ) ) ) return DDENUMRET_CANCEL; D3DCapsStruct.m_ddCaps.dwSize = sizeof(DDCAPS); pDD->GetCaps( &D3DCapsStruct.m_ddCaps, NULL ); if(pDD) { pDD->Release(); pDD = NULL; } ZeroMemory( d3dTexture, sizeof(D3DD_TEXTURE)*D3DD_MAX_TEXTURE_AMOUNT ); ZeroMemory( d3dText, sizeof(D3DD_TEXT)*D3DD_MAX_TEXT_AMOUNT ); ZeroMemory( d3dDisp, sizeof(D3DD_DISP)*D3DD_MAX_DISP_AMOUNT ); pD3D = Direct3DCreate8(D3D_SDK_VERSION); if(pD3D == NULL){ MessageBox(NULL,"Direct3Dオブジェクトの生成に失敗しました。[DirectX8.1が入っていない?]","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } if( FAILED(pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &D3DCapsStruct.m_d3dCaps)) ){ MessageBox(NULL,"デバイス能力の取得に失敗しました","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } EnumAdapters(D3DADAPTER_DEFAULT); if( (int)D3DCapsStruct.m_d3dCaps.MaxTextureWidth < D3DD_TEXTURE_CONTROL_SIZE ){ DebugBox( NULL, "このビデオカードは、幅 %d pixel 以上のサイズのテクスチャを生成できません。[%s]", D3DD_TEXTURE_CONTROL_SIZE); return FALSE; }else if( (int)D3DCapsStruct.m_d3dCaps.MaxTextureHeight < D3DD_TEXTURE_CONTROL_SIZE ){ DebugBox( NULL, "このビデオカードは、高さ %d pixel 以上のサイズのテクスチャを生成できません。[%s]", D3DD_TEXTURE_CONTROL_SIZE ); return FALSE; } if( !(D3DCapsStruct.m_d3dCaps.ShadeCaps&D3DPSHADECAPS_ALPHAGOURAUDBLEND) ){ MessageBox(NULL,"このビデオデバイスはグーロブレンディングに対応していません。\nゲームの画像が乱れることがあります","警告", MB_OK | MB_ICONSTOP); } if( !(D3DCapsStruct.m_d3dCaps.ShadeCaps&D3DPSHADECAPS_COLORGOURAUDRGB) ){ MessageBox(NULL,"このビデオデバイスはグーロシェーディングに対応していません。\nゲームの画像が乱れることがあります","警告", MB_OK | MB_ICONSTOP); } if( D3DCapsStruct.m_d3dCaps.TextureCaps&D3DPTEXTURECAPS_SQUAREONLY ){ DebugBox( NULL, "このビデオカードは長方形テクスチャを生成できません。[デバッグ用ダイアログ]" ); } if( FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&D3DCapsStruct.m_NowDisplayMode)) ){ MessageBox(NULL,"ディスプレイモードの取得に失敗しました。[なにゆえ?]","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } D3DCapsStruct.m_WindowDisplayMode = D3DCapsStruct.m_NowDisplayMode; D3DMain.m_DrawHwnd = hwnd; D3DMain.m_MenuHwnd = menu; if( GetSystemMetrics(SM_CXFULLSCREEN)<=800 || GetSystemMetrics(SM_CYFULLSCREEN)<=600){ D3DMain.m_FullScreenOnly = TRUE; D3DMain.m_WindowMode = FALSE; }else{ D3DMain.m_FullScreenOnly = FALSE; D3DMain.m_WindowMode = !full; } ZeroMemory(&d3dppApp,sizeof(d3dppApp)); WinWidth = w; WinHeight = h; d3dppApp.SwapEffect = D3DSWAPEFFECT_COPY; d3dppApp.BackBufferFormat = D3DCapsStruct.m_NowDisplayMode.Format; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; d3dppApp.Windowed = TRUE; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; HRESULT ret; ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ D3DMain.m_FullScreenOnly = TRUE; } } if(D3DMain.m_FullScreenOnly==TRUE){ RELEASE_3D(pD3DDevice); D3DMain.m_WindowMode = FALSE; ZeroMemory(&d3dppApp,sizeof(d3dppApp)); for(i=0;i<D3DCapsStruct.m_DisplayModeNum;i++){ if( D3DCapsStruct.m_DisplayMode[i].Width == 800 && D3DCapsStruct.m_DisplayMode[i].Height == 600 ){ switch( D3DCapsStruct.m_DisplayMode[i].Format ){ case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: case D3DFMT_A1R5G5B5: case D3DFMT_A4R4G4B4: case D3DFMT_X4R4G4B4: D3DCapsStruct.m_FullModeNum=i; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; d3dppApp.Windowed = D3DMain.m_WindowMode; d3dppApp.SwapEffect = FULL_FLIP; d3dppApp.BackBufferFormat = D3DCapsStruct.m_DisplayMode[i].Format; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; break; } } if(d3dppApp.SwapEffect) break; } if(!full){ wsprintf( buf, "このビデオカードの現在のモードではゲームを実行できません。フルスクリーン化しますか?\n[%d]", D3DCapsStruct.m_DisplayMode[i].RefreshRate ); if( MessageBox( NULL, buf, "問い合わせ", MB_YESNO )==IDNO ){ RELEASE_3D(pD3D); return FALSE; } } ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ switch(ret){ default: case D3DERR_OUTOFVIDEOMEMORY: DebugBox( NULL, "Direct3D が処理を行うのに十分なディスプレイ メモリがありません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_INVALIDCALL: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_INVALIDCALL]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_NOTAVAILABLE: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_NOTAVAILABLE]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; } } } }else{ if(D3DMain.m_WindowMode){ }else{ RELEASE_3D(pD3DDevice); ZeroMemory(&d3dppApp,sizeof(d3dppApp)); d3dppApp.SwapEffect = FULL_FLIP; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; d3dppApp.Windowed = FALSE; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; if(DrawSetting.full_16bit){ d3dppApp.BackBufferFormat=D3DFMT_UNKNOWN; for(i=0;i<D3DCapsStruct.m_DisplayModeNum;i++){ if( D3DCapsStruct.m_DisplayMode[i].Width == 800 && D3DCapsStruct.m_DisplayMode[i].Height == 600 ){ switch( D3DCapsStruct.m_DisplayMode[i].Format ){ case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: case D3DFMT_A1R5G5B5: case D3DFMT_A4R4G4B4: case D3DFMT_X4R4G4B4: D3DCapsStruct.m_FullModeNum=i; d3dppApp.BackBufferFormat = D3DCapsStruct.m_DisplayMode[i].Format; break; } } if(d3dppApp.BackBufferFormat!=D3DFMT_UNKNOWN) break; } }else{ d3dppApp.BackBufferFormat = D3DCapsStruct.m_NowDisplayMode.Format; } ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ switch(ret){ default: case D3DERR_OUTOFVIDEOMEMORY: DebugBox( NULL, "Direct3D が処理を行うのに十分なディスプレイ メモリがありません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_INVALIDCALL: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_INVALIDCALL]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_NOTAVAILABLE: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_NOTAVAILABLE]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; } } } } } if( FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&D3DCapsStruct.m_NowDisplayMode)) ){ MessageBox(NULL,"ディスプレイモードの取得に失敗しました。[なにゆえ?]","致命的なエラー", MB_OK | MB_ICONSTOP); RELEASE_3D(pD3D); return FALSE; } D3DCapsStruct.m_ttCaps.m_R8G8B8 = IsTextureFormatOk( D3DFMT_R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X8R8G8B8 = IsTextureFormatOk( D3DFMT_X8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8R8G8B8 = IsTextureFormatOk( D3DFMT_A8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_R5G6B5 = IsTextureFormatOk( D3DFMT_R5G6B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X1R5G5B5 = IsTextureFormatOk( D3DFMT_X1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A1R5G5B5 = IsTextureFormatOk( D3DFMT_A1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X4R4G4B4 = IsTextureFormatOk( D3DFMT_X4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A4R4G4B4 = IsTextureFormatOk( D3DFMT_A4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8P8 = IsTextureFormatOk( D3DFMT_A8P8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_P8 = IsTextureFormatOk( D3DFMT_P8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8 = IsTextureFormatOk( D3DFMT_A8, D3DCapsStruct.m_NowDisplayMode.Format); D3DD_SetBackBuffer( WinWidth, WinHeight ); pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_ARGB(0,0,0,0),1.0,0); if(0){ char buf2[512]; wsprintf( buf, "実行ディスプレイモード[%s]\n", TxFmtMode[ LIM(d3dppApp.BackBufferFormat,0,D3DFMT_D3DD_MAX-1) ] ); MBS_CPY(buf2,buf); MBS_CAT(buf2,"使用可能テクスチャ列挙\n"); for(i=1;i<D3DFMT_D3DD_MAX-1;i++){ if( TxFmtMode[i] ){ j = IsTextureFormatOk( (D3DFORMAT)i, D3DCapsStruct.m_NowDisplayMode.Format); if(j){ wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], (j==2)?"OK":"OK(NotRenderTarget)" ); MBS_CAT(buf2,buf); }else{ wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], "--Not--" ); MBS_CAT(buf2,buf); } } } DebugBox(NULL,buf2); } D3DD_CreateTable(); return TRUE; }
// Log skin data including materials to file. int SceneIFC::LogSkinInfo( VActor *Thing, TCHAR* SkinName ) // char* ModelName ) { if( !LogPath[0] ) { return 1; // Prevent logs getting lost in root. } TCHAR LogFileName[MAX_PATH]; _stprintf(LogFileName,_T("\\X_ModelInfo_%s%s"),SkinName,_T(".LOG")); DLog.Open(LogPath,LogFileName,DOLOGFILE); if( DLog.Error() ) return 0; DLog.Logf("\n\n Unreal skeletal exporter for " PRODUCT " - Model information for [%s.psk] \n\n",SkinName ); DLog.Logf(" Skin faces: %6i\n",Thing->SkinData.Faces.Num()); DLog.Logf(" Skin vertices: %6i\n",Thing->SkinData.Points.Num()); DLog.Logf(" Skin wedges (vertices with unique U,V): %6i\n",Thing->SkinData.Wedges.Num()); DLog.Logf(" Total bone-to-vertex linkups: %6i\n",Thing->SkinData.RawWeights.Num()); DLog.Logf(" Reference bones: %6i\n",Thing->RefSkeletonBones.Num()); DLog.Logf(" Unique materials: %6i\n",Thing->SkinData.Materials.Num()); DLog.Logf("\n = materials =\n"); // Print out smoothing groups ? if(0) for( INT f=0; f< Thing->SkinData.Faces.Num(); f++) { DLog.Logf(" Smoothing group for face %i is [ %d ] [%X] \n",f,Thing->SkinData.Faces[f].SmoothingGroups,Thing->SkinData.Faces[f].SmoothingGroups ); } DebugBox("Start printing skins"); for( INT i=0; i < Thing->SkinData.Materials.Num(); i++) { DebugBox("Start printing skin [%i]",i); TCHAR MaterialName[256]; #if _UNICODE TCHAR tmp[256]; mbstowcs(tmp, Thing->SkinData.Materials[i].MaterialName, 256); _tcscpy(MaterialName, CleanString(tmp)); #else strcpy(MaterialName, CleanString( Thing->SkinData.Materials[i].MaterialName )); #endif DebugBox("Start printing bitmap"); // Find bitmap: TCHAR BitmapName[MAX_PATH]; TCHAR BitmapPath[MAX_PATH]; if( (Thing->SkinData.RawMaterials.Num()>i) && Thing->SkinData.RawMaterials[i] ) { _tcscpy( BitmapName,Thing->SkinData.RawBMPaths[i].RawBitmapName ); _tcscpy( BitmapPath,Thing->SkinData.RawBMPaths[i].RawBitmapPath ); } else { _stprintf(BitmapName,_T("[Internal material]")); } DebugBox("Retrieved bitmapname"); // Log. DLog.Logf(" * Index: [%2i] name: %s \n",i, MaterialName); if( BitmapName[0] ) DLog.Logf(_T(" Original bitmap: %s Path: %s\n "),BitmapName,BitmapPath); DLog.Logf(" - Skin Index: %2i\n",Thing->SkinData.Materials[i].TextureIndex ); DebugBox("End printing bitmap"); DWORD Flags = Thing->SkinData.Materials[i].PolyFlags; DLog.Logf(" - render mode flags:\n"); if( Flags & MTT_NormalTwoSided ) DLog.Logf(" - Twosided\n"); if( Flags & MTT_Unlit ) DLog.Logf(" - Unlit\n"); if( Flags & MTT_Translucent ) DLog.Logf(" - Translucent\n"); if( (Flags & MTT_Masked) == MTT_Masked ) DLog.Logf(" - Masked\n"); if( Flags & MTT_Modulate ) DLog.Logf(" - Modulated\n"); if( Flags & MTT_Placeholder ) DLog.Logf(" - Invisible\n"); if( Flags & MTT_Alpha ) DLog.Logf(" - Per-pixel alpha.\n"); //if( Flags & MTT_Flat ) DLog.Logf(" - Flat\n"); if( Flags & MTT_Environment ) DLog.Logf(" - Environment mapped\n"); if( Flags & MTT_NoSmooth ) DLog.Logf(" - Nosmooth\n"); } //#DEBUG print out smoothing groups /* for( INT f=0; f < Thing->SkinData.Faces.Num(); f++ ) { DLog.Logf(" Face [%4i] Smoothing group: %4i mat: %4i \n ", f, Thing->SkinData.Faces[f].SmoothingGroups, Thing->SkinData.Faces[f].MatIndex ); } */ // Print out bones list DLog.Logf(" \n\n"); DLog.Logf(" BONE LIST [%i] total bones in reference skeleton. \n",Thing->RefSkeletonBones.Num()); DLog.Logf(" number name (parent) \n"); for( INT b=0; b < Thing->RefSkeletonBones.Num(); b++) { DLog.Logf(" [%3i ] [%s] (%3i ) \n",b, Thing->RefSkeletonBones[b].Name, Thing->RefSkeletonBones[b].ParentIndex ); } DLog.Logf(" \n\n"); DLog.Close(); return 1; }
void ShowInfoText() { DebugBox frameInfo = DebugBox(Vec2i(10, 10), "FrameInfo"); frameInfo.add("Prims", EERIEDrawnPolys); frameInfo.add("Particles", getParticleCount()); frameInfo.add("Polybooms", long(polyboom.size())); frameInfo.add("TIME", static_cast<long>(arxtime.now_ul() / 1000)); frameInfo.print(); DebugBox playerBox = DebugBox(Vec2i(10, frameInfo.size().y + 5), "Player"); playerBox.add("Position", player.pos); playerBox.add("AnchorPos", player.pos - Mscenepos); playerBox.add("Rotation", player.angle); playerBox.add("Velocity", player.physics.velocity); EERIEPOLY * ep = CheckInPoly(player.pos); float truePolyY = -666.66f; if(ep) { float tempY = 0.f; if(GetTruePolyY(ep, player.pos, &tempY)) { truePolyY = tempY; } } ep = CheckInPoly(player.pos + Vec3f(0.f, -10.f, 0.f)); float slope = 0.f; if(ep) slope = ep->norm.y; long zap = IsAnyPolyThere(player.pos.x,player.pos.z); playerBox.add("Ground Slope", slope); playerBox.add("Ground truePolyY", truePolyY); playerBox.add("Ground POLY", zap); playerBox.add("Color", CURRENT_PLAYER_COLOR); playerBox.add("Stealth", GetPlayerStealth()); playerBox.add("Jump", player.jumplastposition); playerBox.add("OFFGRND", (!player.onfirmground ? "OFFGRND" : "")); playerBox.add("Life", player.lifePool); playerBox.add("Mana", player.manaPool); playerBox.add("Poisoned", player.poison); playerBox.add("Hunger", player.hunger); playerBox.add("Magic", static_cast<long>(player.doingmagic)); playerBox.print(); DebugBox miscBox = DebugBox(Vec2i(10, playerBox.size().y + 5), "Misc"); miscBox.add("Arx version", arx_version); miscBox.add("Level", LastLoadedScene.string().c_str()); miscBox.add("Spell failed seq", LAST_FAILED_SEQUENCE.c_str()); miscBox.add("Camera focal", ACTIVECAM->focal); miscBox.add("Cinema", CINEMA_DECAL); miscBox.add("Mouse", Vec2i(DANAEMouse)); miscBox.add("Pathfind queue", EERIE_PATHFINDER_Get_Queued_Number()); miscBox.add("Pathfind status", (PATHFINDER_WORKING ? "Working" : "Idled")); miscBox.print(); { struct ScriptDebugReport { std::string entityName; long events; long sends; ScriptDebugReport() : entityName("") , events(0) , sends(0) {} }; ScriptDebugReport maxEvents; Entity * io = ARX_SCRIPT_Get_IO_Max_Events(); if(io) { maxEvents.entityName = io->idString(); maxEvents.events = io->stat_count; } ScriptDebugReport maxSender; io = ARX_SCRIPT_Get_IO_Max_Events_Sent(); if(io) { maxSender.entityName = io->idString(); maxSender.sends = io->stat_sent; } DebugBox scriptBox = DebugBox(Vec2i(10, miscBox.size().y + 5), "Script"); scriptBox.add("Events", ScriptEvent::totalCount); scriptBox.add("Timers", ARX_SCRIPT_CountTimers()); scriptBox.add("Max events", maxEvents.entityName); scriptBox.add("Max events#", maxEvents.events); scriptBox.add("Max sender", maxSender.entityName); scriptBox.add("Max sender#", maxSender.sends); scriptBox.print(); } if(ValidIONum(LastSelectedIONum)) { Entity * io = entities[LastSelectedIONum]; if(io) { DebugBox entityBox = DebugBox(Vec2i(500, 10), "Entity " + io->idString()); entityBox.add("Pos", io->pos); entityBox.add("Angle", io->angle); entityBox.add("Room", static_cast<long>(io->room)); entityBox.add("Move", io->move); entityBox.add("Flags", flagNames(EntityFlagNames, io->ioflags)); entityBox.add("Show", entityVisilibityToString(io->show)); entityBox.print(); if(io->ioflags & IO_NPC) { IO_NPCDATA * npcData = io->_npcdata; DebugBox npcBox = DebugBox(Vec2i(500, entityBox.size().y + 5), "NPC"); npcBox.add("Life", npcData->lifePool); npcBox.add("Mana", npcData->manaPool); npcBox.add("Poisoned", npcData->poisonned); npcBox.add("ArmorClass", ARX_INTERACTIVE_GetArmorClass(io)); npcBox.add("Absorb", npcData->absorb); npcBox.add("Moveproblem", npcData->moveproblem); npcBox.add("Pathfind listpos", static_cast<long>(npcData->pathfind.listpos)); npcBox.add("Pathfind listnb", npcData->pathfind.listnb); npcBox.add("Pathfind targ", npcData->pathfind.truetarget.handleData()); npcBox.add("Behavior", flagNames(BehaviourFlagNames, npcData->behavior)); // TODO should those really be flags ? PathfindFlags pflag = io->_npcdata->pathfind.flags; std::string pflags; if(pflag & PATHFIND_ALWAYS) pflags += "ALWAYS "; if(pflag & PATHFIND_ONCE) pflags += "ONCE "; if(pflag & PATHFIND_NO_UPDATE) pflags += "NO_UPDATE "; npcBox.add("Pathfind flgs", pflags); npcBox.print(); } if(io->ioflags & (IO_FIX | IO_ITEM)) { DebugBox itemBox = DebugBox(Vec2i(500, entityBox.size().y + 5), "Item"); itemBox.add("Durability", io->durability); itemBox.add("Durability max", io->max_durability); itemBox.add("Poisonous", static_cast<long>(io->poisonous)); itemBox.add("Poisonous count", static_cast<long>(io->poisonous_count)); itemBox.print(); } } } ARX_SCRIPT_Init_Event_Stats(); }
TGAHead *LoadTgaInMemory( BYTE *ptr, BYTE **bmp, BYTE **pal, int *palnum, int *srcw, int *srch, int *bbp, int *alpha, int *hrev, int rgb_pal_ptn ) { int i; static TGAHead tgaHead; tgaHead = *(TGAHead*)ptr; ptr+=sizeof(tgaHead); if(tgaHead.imageType==9 || tgaHead.imageType==10){ DebugBox(NULL,"このライブラリは、圧縮TGAをサポートしていません"); return NULL; } *srcw = tgaHead.imageInfo.width; *srch = tgaHead.imageInfo.height; *bbp = tgaHead.imageInfo.depth; *hrev = tgaHead.imageInfo.param&0x20; *alpha = 0; *palnum = 0; *pal = NULL; switch(*bbp){ case 8: *palnum = tgaHead.cmInfo[2] + tgaHead.cmInfo[3]*256; if(tgaHead.cmInfo[4]==24){ RGB_ *rgb=(RGB_*)ptr; static RGBA rgba[256]; *pal = (BYTE*)rgba; ptr += sizeof(RGB_) * *palnum; if(rgb_pal_ptn){ for(i=0;i<*palnum;i++){ rgba[i].blue = rgb[i].red; rgba[i].green = rgb[i].green; rgba[i].red = rgb[i].blue; rgba[i].alpha = 255; } }else{ for(i=0;i<*palnum;i++){ rgba[i].blue = rgb[i].blue; rgba[i].green = rgb[i].green; rgba[i].red = rgb[i].red; rgba[i].alpha = 255; } } *alpha=0; }else{ RGBA *rgb=(RGBA*)ptr; *pal = ptr; ptr += sizeof(RGBA) * *palnum; if(rgb_pal_ptn){ for(i=0;i<*palnum;i++){ BYTE work=rgb[i].blue; rgb[i].blue = rgb[i].red; rgb[i].green = rgb[i].green; rgb[i].red = work; rgb[i].alpha = rgb[i].alpha; } } *alpha=1; } break; case 32: *alpha=1; case 24: break; } *bmp = ptr; return &tgaHead; }