source: golgotha/src/render/tex_id.cc

Last change on this file was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.4 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "tex_id.hh"
10#include "string/string.hh"
11#include "file/file.hh"
12#include "string/str_checksum.hh"
13#include "r1_res.hh"
14
15r1_texture_ref *r1_texture_ref::first=0;
16
17i4_str *r1_texture_id_to_filename(w32 id,
18                                  const i4_const_str &out_dir)
19{
20  return i4_const_str("%S/%x.gtx").sprintf(100,
21                                          &out_dir,
22                                          id);
23
24}
25
26w32 r1_get_texture_id(const i4_const_str &full_filename)
27{
28  if (!full_filename.null())
29  {
30    i4_filename_struct fn;
31    i4_split_path(full_filename, fn);
32    w32 id=i4_str_checksum(fn.filename);
33    return id;
34  }
35  else return 0;
36}
37
38
39
40r1_texture_ref::~r1_texture_ref()
41{
42  if (this==first)
43    first=first->next;
44  else
45  {
46    r1_texture_ref *p, *last=0;   
47    for (p=first; p!=this;)
48      last=p; p=p->next;
49    last->next=next;
50  } 
51}
Note: See TracBrowser for help on using the repository browser.