Id
and CPlayer::m_ClientID/GetCid()
equally. That's wrong, because Id
has to be used when sending snaps to the client, for the translation layer, and the other has to be used when using the actual client id in the code itself.
This should be done before 128p server-side launches.datafile
mod in crate twmap
.RawDatafile
struct in crate twmap
.let mut module = Module::new("example");
let mut func = Function::new("main", &[Parameter::new(Type::Int(32))], Type::Int(32));
let param = func.param(0)?;
let entry_block = func.entry_block;
let value = func.blocks[entry_block].instr_add(¶m, &Operand::const_i32(4))?;
let then_block = func.add_block(&[]);
let else_block = func.add_block(&[]);
let final_block = func.add_block(&[Type::Int(32)]);
let cond = func.blocks[entry_block].instr_icmp(
IcmpCond::Eq,
value.clone(),
Operand::const_i32(6),
)?;
func.blocks[entry_block].instr_cond_jmp(then_block, else_block, &cond, &[], &[]);
{
let value = func.blocks[then_block].instr_add(&value, &Operand::const_i32(2))?;
func.blocks[then_block].instr_jmp(final_block, &[value]);
}
{
let value = func.blocks[else_block].instr_add(&value, &Operand::const_i32(6))?;
func.blocks[else_block].instr_jmp(final_block, &[value]);
}
{
let param = func.blocks[final_block].arg(0)?;
func.blocks[final_block].instr_ret(Some(¶m));
}
module.functions.insert(func);
lower_module_to_llvmir(&module)?;
makes the following ir:
; ModuleID = 'example'
source_filename = "example"
define i32 @main(i32 %0) {
entry:
%1 = add i32 %0, 4
%2 = icmp eq i32 %1, 6
br i1 %2, label %bb0_true_1, label %bb0_false_2
%3 = add i32 %1, 2
bb0_true_1: ; preds = %entry
br label %bbbr
ret i32 %5
%4 = add i32 %3, 6
br label %bbbr
ret i32 %5
bb0_false_2: ; preds = %entry
bbbr: ; preds = %bb0_true_1, %bb0_true_1
%5 = phi i32 [ %3, %bb0_true_1 ], [ %3, %bb0_false_2 ]
}
@MilkeeyCat current IRVM status, can make simple stuff, the api can be improved more tho let preds = ctx.func.find_preds_for(block_idx);
let mut block_args = Vec::new();
if !preds.is_empty() {
let operand_len = preds.first().unwrap().1.len();
for i in 0..(operand_len) {
let phy_ty = lower_type(ctx.ctx, preds.first().unwrap().1[i].get_type());
let phi_node = core::LLVMBuildPhi(ctx.builder, phy_ty, c"".as_ptr());
let mut blocks = Vec::new();
let mut values = Vec::new();
for (pred_block_idx, operands) in &preds {
let value = lower_operand(ctx, &operands[i]);
let pred_ptr = ctx.blocks.get(&pred_block_idx.to_idx()).unwrap();
blocks.push(*pred_ptr);
values.push(value);
}
assert_eq!(values.len(), values.len());
core::LLVMAddIncoming(
phi_node,
values.as_mut_ptr().cast(),
blocks.as_mut_ptr().cast(),
blocks.len() as u32,
);
block_args.push(phi_node);
}
}
ctx.block_args.insert(block_idx.to_idx(), block_args);
(the lowering to llvm uses unsafe cuz using the llvm c api directly); ModuleID = 'example'
source_filename = "example"
define i32 @main(i32 %0) {
entry:
%1 = add i32 %0, 4
%2 = icmp eq i32 %1, 6
br i1 %2, label %bb0_true_1, label %bb0_false_2
bb0_true_1: ; preds = %entry
%3 = add i32 %1, 2
br label %bbbr
bb0_false_2: ; preds = %entry
%4 = add i32 %3, 6
br label %bbbr
bbbr: ; preds = %bb0_false_2, %bb0_true_1
%5 = phi i32 [ %3, %bb0_true_1 ], [ %3, %bb0_false_2 ]
ret i32 %5
}
(edited)dbg_assert
s are always enabledlet mut module = Module::new("example");
let mut func = Function::new("main", &[Parameter::new(Type::Int(32))], Type::Int(32));
let param = func.param(0)?;
let entry_block = func.entry_block;
let value = func.blocks[entry_block].instr_add(¶m, &Operand::const_i32(4))?;
let then_block = func.add_block(&[]);
let else_block = func.add_block(&[]);
let final_block = func.add_block(&[Type::Int(32)]);
let cond = func.blocks[entry_block].instr_icmp(
IcmpCond::Eq,
value.clone(),
Operand::const_i32(6),
)?;
func.blocks[entry_block].instr_cond_jmp(then_block, else_block, &cond, &[], &[]);
{
let value = func.blocks[then_block].instr_add(&value, &Operand::const_i32(2))?;
func.blocks[then_block].instr_jmp(final_block, &[value]);
}
{
let value = func.blocks[else_block].instr_add(&value, &Operand::const_i32(6))?;
func.blocks[else_block].instr_jmp(final_block, &[value]);
}
{
let param = func.blocks[final_block].arg(0)?;
func.blocks[final_block].instr_ret(Some(¶m));
}
module.functions.insert(func);
lower_module_to_llvmir(&module)?;
makes the following ir:
; ModuleID = 'example'
source_filename = "example"
define i32 @main(i32 %0) {
entry:
%1 = add i32 %0, 4
%2 = icmp eq i32 %1, 6
br i1 %2, label %bb0_true_1, label %bb0_false_2
%3 = add i32 %1, 2
bb0_true_1: ; preds = %entry
br label %bbbr
ret i32 %5
%4 = add i32 %3, 6
br label %bbbr
ret i32 %5
bb0_false_2: ; preds = %entry
bbbr: ; preds = %bb0_true_1, %bb0_true_1
%5 = phi i32 [ %3, %bb0_true_1 ], [ %3, %bb0_false_2 ]
}
@MilkeeyCat current IRVM status, can make simple stuff, the api can be improved more tho let mut module = Module::new("example");
let mut func = Function::new("main", &[Parameter::new(Type::Int(32))], Type::Int(32));
let param = func.param(0)?;
let entry_block = func.entry_block;
let value = func.blocks[entry_block].instr_add(¶m, &Operand::const_i32(4))?;
let then_block = func.add_block(&[]);
let else_block = func.add_block(&[]);
let final_block = func.add_block(&[Type::Int(32)]);
let cond = func.blocks[entry_block].instr_icmp(
IcmpCond::Eq,
value.clone(),
Operand::const_i32(6),
)?;
func.blocks[entry_block].instr_cond_jmp(then_block, else_block, &cond, &[], &[]);
{
let value = func.blocks[then_block].instr_add(&value, &Operand::const_i32(2))?;
func.blocks[then_block].instr_jmp(final_block, &[value]);
}
{
let value = func.blocks[else_block].instr_add(&value, &Operand::const_i32(6))?;
func.blocks[else_block].instr_jmp(final_block, &[value]);
}
{
let param = func.blocks[final_block].arg(0)?;
func.blocks[final_block].instr_ret(Some(¶m));
}
module.functions.insert(func);
lower_module_to_llvmir(&module)?;
makes the following ir:
; ModuleID = 'example'
source_filename = "example"
define i32 @main(i32 %0) {
entry:
%1 = add i32 %0, 4
%2 = icmp eq i32 %1, 6
br i1 %2, label %bb0_true_1, label %bb0_false_2
%3 = add i32 %1, 2
bb0_true_1: ; preds = %entry
br label %bbbr
ret i32 %5
%4 = add i32 %3, 6
br label %bbbr
ret i32 %5
bb0_false_2: ; preds = %entry
bbbr: ; preds = %bb0_true_1, %bb0_true_1
%5 = phi i32 [ %3, %bb0_true_1 ], [ %3, %bb0_false_2 ]
}
@MilkeeyCat current IRVM status, can make simple stuff, the api can be improved more tho TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
// create text container, or just draw text
TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
// create text container, or just draw text
TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
OVERLAYRENDERFLAG_TEXT
but it's never passed as an argumentg_Config.m_ClTextEntitiesTune
which is either 0 or 1IsTileBufferingEnabled()
return truex = othervelrampvalue/(tick_speed * log(curvature))
(edited)x = othervelrampvalue/(tick_speed * log(curvature))
(edited)std::log
isn't too optimized, but we can replace that with some approximate log if needed, a taylor series approximation should be pretty accurate and cheap if needed@cached
for lookup xD@cached
for lookup xD std::log
is more optimized than I think, a cache-miss would instantly make it slower, so caching is not the best ideax = othervelrampvalue/(tick_speed * log(curvature))
(edited)curvature <= 0
std::log
isn't too optimized, but we can replace that with some approximate log if needed, a taylor series approximation should be pretty accurate and cheap if needed x = othervelrampvalue/(tick_speed * log(curvature))
(edited) float MaxRampSpeed = GetTuning(m_TuneZone)->m_VelrampRange/(50 * log(maximum(GetTuning(m_TuneZone)->m_VelrampCurvature, 1.01f)));
MaxSpeed = maximum(MaxRampSpeed, GetTuning(m_TuneZone)->m_VelrampStart / 50) * MaxSpeedScale;
dbg_assert
s are always enabled