冒险解谜游戏中文网 ChinaAVG

标题: 半影系列引擎源代码公开 2010.10.7 更新 [打印本页]

作者: shane007    时间: 2010-10-5 23:53
标题: 半影系列引擎源代码公开 2010.10.7 更新
相关网址
; y- v. @! r( chttp://www.frictionalgames.com/forum/forum-27.html / v( C6 Z$ T! t, a8 Z7 n
: J* a. L8 d1 b: l2 C! k  z4 W7 r
----------------------------------8 A9 z4 L" {: O: ^# N" O
2010.10.7 更新
+ C7 c! C. e( p& k- I4 q  c研究了一下这个游戏的源代码,在\sources\resources\FontManager.cpp里,我发现这个游戏还可以支持ttf字体文件。8 D/ \! c9 ^3 t/ b
方法很简单,只要在fonts目录下放上和.fnt文件同名的.ttf文件,然后把.fnt文件移走即可。3 j5 o9 }( I$ |4 i( A/ b# d
相关代码如下5 \$ H/ n/ B  N0 L' I" N/ c
iFontData* cFontManager::CreateFontData(const tString& asName, int alSize,unsigned short alFirstChar,1 D7 {7 ^6 |1 n6 R
           unsigned short alLastChar)& @2 W' a' r6 B& L0 y  S2 k: ?8 B; x
{
2 k& T" p+ ~$ k0 o3 P* L, m  tString sPath;7 @" n) F, ~; ^5 k- \
  iFontData* pFont;) k& _* b3 n1 n; R. P8 ^. {$ r! T
  tString asNewName = cString::ToLowerCase(asName);
: y8 @, s* f& [/ x- ~* ]  BeginLoad(asName);
: M! i. T3 ^$ O) B7 ]7 E  
! R  A, d$ v. L5 `8 y  //asNewName = cString::SetFileExt(asName,"ttf");
6 ^" ?  z0 b6 b) z& q  pFont = static_cast<iFontData*>(this->FindLoadedResource(asNewName,sPath));* b9 G) b4 S5 U4 \
  if(pFont==NULL && sPath!="")& M$ B; ~) U! Y& H2 }
  {
6 Z; J1 M: o/ q0 K& c/ ?8 A3 I7 \7 v   pFont = mpGraphics->GetLowLevel()->CreateFontData(asNewName);
3 }4 m+ H1 W1 h/ b$ d   pFont->SetUp(mpGraphics->GetDrawer(),mpLowLevelResources,mpGui);
: I- v* T6 c7 @0 t" }! Y   $ n7 y- Y% Y- V
   tString sExt = cString::ToLowerCase(cString::GetFileExt(asName));, y& H& S- G9 a
   //True Type Font
% E, c( y- P3 q4 y! R   if(sExt == "ttf")
& }3 Y! f6 k, ~$ d   {. v6 ?( G4 S2 f
    if(pFont->CreateFromFontFile(sPath,alSize,alFirstChar,alLastChar)==false){
5 Q. b) M5 Q- |9 M1 y     hplDelete(pFont);
$ H$ Z2 a* A7 r     EndLoad();
2 f( J) V  B% Z# a8 J0 |* E     return NULL;
5 x& }- B8 x% @* ?    }
/ x2 W' m6 O3 y% I6 w6 p   }
' E6 L! }" I0 D2 T& F. w/ `   //Angel code font type. M4 r, ^( r1 ^* q" a/ X8 r1 g2 x3 T
   else if(sExt == "fnt")
$ V7 o' k9 w) V" z3 h2 r- P# K   {. h! A9 E, @; N; h- {# Q
    if(pFont->CreateFromBitmapFile(sPath)==false){
$ s/ ]; w! m6 I     hplDelete(pFont);  y: p$ {- v1 Y( d, w
     EndLoad();+ K$ a; n$ f) W2 \6 U7 V! e) w
     return NULL;
' y" s1 v+ M7 b0 g+ {    }
- @- d5 u! [6 H3 ]# {   }
  ^" U6 Y& Q1 _; @" f   else5 g) l. `* H; w4 L8 B8 S) ?
   {) W1 G. R! @8 p6 s( P
    Error("Font '%s' has an unkown extension!\n",asName.c_str());2 k$ x4 ^: J" A# ]1 W9 v5 T
    hplDelete(pFont);2 [+ L! o) X0 w+ d- T% K6 ~
    EndLoad();0 N" U) r& B! [% Y( Z4 x# I* u
    return NULL;
* x3 n8 M. P) v2 X% }2 b4 q   }
! d/ ^2 f* z$ J, r7 M* o) b   4 |: ~1 z" X  ?, u- H
   //mpResources->GetImageManager()->FlushAll();! k' L* B7 @" Q: ~2 T% a0 @
   AddResource(pFont);! R9 b# d9 K4 r: T1 \
  }4 {! s+ O$ j+ W9 c
  if(pFont)pFont->IncUserCount();6 X7 \5 y+ S' ~9 i
  else Error("Couldn't create font '%s'\n",asNewName.c_str());
+ H  K+ W& m5 v0 `; Z1 M3 u  0 [5 Y4 N. H/ h
  EndLoad();$ M9 Y+ X4 A( t
  return pFont;
" Y$ r( x4 d3 I% J, W" R6 T  p }
作者: shane007    时间: 2010-10-7 07:58
Credits.cpp(44):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");, a* K! P7 b" @2 y
DeathMenu.cpp(45):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");8 h% t0 K- V0 w9 h. u% |4 ^$ @
DeathMenu.cpp(177):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");& E/ W" `# S8 B( L' j$ m
DemoEndText.cpp(39):     //mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");. {0 f2 p! N" P1 ]4 B% Z. M% ~5 ?3 h
EffectHandler.cpp(676):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");$ `9 d6 p( a' s, V9 _! b
GameMessageHandler.cpp(39):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
, S6 Y' ]4 e- z  G' D6 m  DGraphicsHelper.cpp(40):     mpFont =mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt");" ?% m) ]" Y: _
Init.cpp(607):     mpDefaultFont = mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");, m" C; q* k$ r! w/ S8 A: h7 e  s( f
IntroStory.cpp(340):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");
5 N+ K& }6 r4 K9 J/ e7 ?6 h# KInventory.cpp(59):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");7 d# R2 ?. l5 c- I
Inventory.cpp(193):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");2 m2 O  o; `# C* P
Inventory.cpp(744):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
: F' [1 K6 u, u' s9 J) [5 S' d7 _MainMenu.cpp(101):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);  p. h& M3 K! a" L
MainMenu.cpp(188):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);5 f, M/ T* }& \$ h8 w: M
MainMenu.cpp(291):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
( a' o4 r( C6 i8 r: u! a" I) Q: hMainMenu.cpp(410):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
9 |( `. P/ f' P1 DMainMenu.cpp(2070):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",20,32,255);
! v: J7 P; e( \: rMainMenu.cpp(2071):     mpTipFont  = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
3 @' j, o( d3 ]( k& k# t; C. KMapLoadText.cpp(40):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
0 H+ h5 n6 x: P2 v) l+ |MapLoadText.cpp(41):     mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");0 [  @1 Y. M( F0 {( {
Notebook.cpp(39):     mpFrontFont =  mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");, E3 Q6 _! u6 w" b
Notebook.cpp(168):     mpTextFont =  mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("cour.fnt",14);! J9 F; @% m  ~/ c
Notebook.cpp(397):     mpTextFont =  mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt",14);+ @+ b' k6 b+ H/ M
Notebook.cpp(670):     mpTextFont =  mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("cour.fnt",14);
4 g* q- M7 G* g$ mNotebook.cpp(671):     mpNavigateFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
  U, h. X8 {( Q8 y8 [Player.cpp(196):     mpFont = mpResources->GetFontManager()->CreateFontData("verdana.fnt");
& b2 n  V2 {0 K- W5 Y- {PlayerHelper.cpp(2134):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");' I' M0 }, ~; d/ X
PlayerState_Interact.cpp(53):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");2 N" n" h+ F3 ~9 G/ B3 i# d
PlayerState_InteractHaptX.cpp(54):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");3 H" k) Q& i: j5 Z* F) o2 x
PreMenu.cpp(39):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
" ?* W( ?7 u' }4 B( o( ZPreMenu.cpp(40):     mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");
7 b6 A, E+ k/ uRadioHandler.cpp(35):     mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
作者: shane007    时间: 2010-10-7 11:42
2010.10.7 更新




欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/) Powered by Discuz! X3.2